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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|