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
|
|||
|
|||
Open Report Argument method
Access2003;
am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
#2
|
|||
|
|||
Open Report Argument method
Try:
strCriteria = "[ReportField] = '" & [Me.FormControl1] & "'" Exaggerated for clarity, that's strCriteria = "[ReportField] = ' " & [Me.FormControl1] & " ' " HTH, Rob "NetworkTrade" wrote in message ... Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
#3
|
|||
|
|||
Open Report Argument method
NetworkTrade wrote:
Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... strCriteria = "[ReportField] = '" & Me.FormControl1 & "'" For clarity only... strCriteria = "[ReportField] = ' " & Me.FormControl1 & " ' " -- Rick Brandt, Microsoft Access MVP Email (as appropriate) to... RBrandt at Hunter dot com |
#4
|
|||
|
|||
Open Report Argument method
runtime error 2465
Access can not find the field "I" referred to in your expression now I understand it seems that I have misnamed the control or a typo or something but after triple checking am left confused..... possibly the problem is not the syntax but the recognition of the field....but not sure -- NTC "Rob Parker" wrote: Try: strCriteria = "[ReportField] = '" & [Me.FormControl1] & "'" Exaggerated for clarity, that's strCriteria = "[ReportField] = ' " & [Me.FormControl1] & " ' " HTH, Rob "NetworkTrade" wrote in message ... Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
#5
|
|||
|
|||
Open Report Argument method
[Report Field] has to be the name of a field in the table or query that is
the Record Source property of the report. -- Dave Hargis, Microsoft Access MVP "NetworkTrade" wrote: runtime error 2465 Access can not find the field "I" referred to in your expression now I understand it seems that I have misnamed the control or a typo or something but after triple checking am left confused..... possibly the problem is not the syntax but the recognition of the field....but not sure -- NTC "Rob Parker" wrote: Try: strCriteria = "[ReportField] = '" & [Me.FormControl1] & "'" Exaggerated for clarity, that's strCriteria = "[ReportField] = ' " & [Me.FormControl1] & " ' " HTH, Rob "NetworkTrade" wrote in message ... Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
#6
|
|||
|
|||
Open Report Argument method
am fairly certain it is; am relying on the fact that it all works when opened
via the macro as my sanity check......in terms of having the correct names of the fields involved.... I removed the variable: ' " & [Me.FormControl1] & " ' And replaced it as a trial with one valid ID: 'ABC' And it opened the report fine/correctly to the ABC record.... remain baffled.... -- NTC "Klatuu" wrote: [Report Field] has to be the name of a field in the table or query that is the Record Source property of the report. -- Dave Hargis, Microsoft Access MVP "NetworkTrade" wrote: runtime error 2465 Access can not find the field "I" referred to in your expression now I understand it seems that I have misnamed the control or a typo or something but after triple checking am left confused..... possibly the problem is not the syntax but the recognition of the field....but not sure -- NTC "Rob Parker" wrote: Try: strCriteria = "[ReportField] = '" & [Me.FormControl1] & "'" Exaggerated for clarity, that's strCriteria = "[ReportField] = ' " & [Me.FormControl1] & " ' " HTH, Rob "NetworkTrade" wrote in message ... Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
#7
|
|||
|
|||
Open Report Argument method
"NetworkTrade" wrote
I removed the variable: ' " & [Me.FormControl1] & " ' And replaced it as a trial with one valid ID: 'ABC' And it opened the report fine/correctly to the ABC record.... remain baffled.... Where is this code? What is the exact... copy and paste... code? Are ReportField and FormControl1 the genuine, real names, or were you "sparing us the confusion". If so, there may be something that is germane that we are missing. Put a breakpoint on the instruction after your code and examine the contents actually calculated for strCriteria. With the answers to the three questions above, and the (again, exact, copied-and-pasted) content of strCriteria, someone may be able to offer a useful suggestion. Larry |
#8
|
|||
|
|||
Open Report Argument method
This may be the problem:
[Me.FormControl1] You may need to fully qualify the reference: Forms!MyFormName!MyControlName -- Dave Hargis, Microsoft Access MVP "NetworkTrade" wrote: am fairly certain it is; am relying on the fact that it all works when opened via the macro as my sanity check......in terms of having the correct names of the fields involved.... I removed the variable: ' " & [Me.FormControl1] & " ' And replaced it as a trial with one valid ID: 'ABC' And it opened the report fine/correctly to the ABC record.... remain baffled.... -- NTC "Klatuu" wrote: [Report Field] has to be the name of a field in the table or query that is the Record Source property of the report. -- Dave Hargis, Microsoft Access MVP "NetworkTrade" wrote: runtime error 2465 Access can not find the field "I" referred to in your expression now I understand it seems that I have misnamed the control or a typo or something but after triple checking am left confused..... possibly the problem is not the syntax but the recognition of the field....but not sure -- NTC "Rob Parker" wrote: Try: strCriteria = "[ReportField] = '" & [Me.FormControl1] & "'" Exaggerated for clarity, that's strCriteria = "[ReportField] = ' " & [Me.FormControl1] & " ' " HTH, Rob "NetworkTrade" wrote in message ... Access2003; am humbled and had to use a macro to open a report to a specific record... in the Where clause of the OpenReport macro I put: [ReportField]=Forms![Form1].[FormControl1] everything works fine....... but went around in circles attempting to do this via the OpenReport argument and would greatly appreciate some patient guidance. Thought this should work: Dim strCriteria As String strCriteria = "[ReportField] = &[Me.FormControl1]&" DoCmd.OpenReport "NameOfReport", acViewPreview, , strCriteria I think I did every conceivable combination of " ' in surrounding the variable FormControl1 (which is a text field) but to no avail... -- NTC |
Thread Tools | |
Display Modes | |
|
|