A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report button linked to exact report record- Open report method?



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 05:51 PM
Rich
external usenet poster
 
Posts: n/a
Default Report button linked to exact report record- Open report method?

Cheryl,
I am not sure I understand so let me explain my train of thought.

First, the field that links all of the different tables and uniquelly identifies my record is the "ID" field. So, in the code that you gave me I would Replace "CustID" with "ID". What I dont udnerstand is where to place this code. I have a button (that i created with a wizard) on my "Destruction Request" form that opens my "Destruction Request" Report. When i click on the properties for the button I do not see a OpenReport option. Do you mean to place it on the On click option?

I am confused..
I really appreciate your help, thanks
-Rich

----- Cheryl Fischer wrote: -----

Rich,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form. For
example, if the field on your form that uniquely identifies the record is
CustID, you could use it to determine the where condition as follows:

Dim strCriteria As String

' This works when your CustID field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your CustID field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria


--

Cheryl Fischer, MVP Microsoft Access



"Rich" wrote in message
...
Hi,
I have created a form that, ultimately, fills out a form that I use on a

regular basis. I have created a report preview button, but when I click it,
it always goes to the first record in the series of reports. What I would
like to accomplish is that if I am in the form on record #5 that when I
click the Report Preview button that it goes to the corresponding
report(#5).
Thanks in advance
-Rich









  #2  
Old May 27th, 2004, 06:17 PM
Cheryl Fischer
external usenet poster
 
Posts: n/a
Default Report button linked to exact report record- Open report method?

Response is in your 10:06 am post

--

Cheryl Fischer, MVP Microsoft Access



"Rich" wrote in message
...
Cheryl,
I am not sure I understand so let me explain my train of thought.

First, the field that links all of the different tables and uniquelly

identifies my record is the "ID" field. So, in the code that you gave me I
would Replace "CustID" with "ID". What I dont udnerstand is where to place
this code. I have a button (that i created with a wizard) on my "Destruction
Request" form that opens my "Destruction Request" Report. When i click on
the properties for the button I do not see a OpenReport option. Do you mean
to place it on the On click option?

I am confused..
I really appreciate your help, thanks
-Rich

----- Cheryl Fischer wrote: -----

Rich,

You will need to add a Where Condition to the OpenReport method so

that the
report shows only the information for the record displayed on your

form. For
example, if the field on your form that uniquely identifies the

record is
CustID, you could use it to determine the where condition as

follows:

Dim strCriteria As String

' This works when your CustID field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your CustID field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria


--

Cheryl Fischer, MVP Microsoft Access



"Rich" wrote in message
...
Hi,
I have created a form that, ultimately, fills out a form that I use

on a
regular basis. I have created a report preview button, but when I

click it,
it always goes to the first record in the series of reports. What I

would
like to accomplish is that if I am in the form on record #5 that when

I
click the Report Preview button that it goes to the corresponding
report(#5).
Thanks in advance
-Rich











 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:20 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.