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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open Report Argument method



 
 
Thread Tools Display Modes
  #1  
Old September 7th, 2007, 02:58 AM posted to microsoft.public.access.reports
NetworkTrade
external usenet poster
 
Posts: 825
Default 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  
Old September 7th, 2007, 03:22 AM posted to microsoft.public.access.reports
Rob Parker
external usenet poster
 
Posts: 701
Default 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  
Old September 7th, 2007, 03:22 AM posted to microsoft.public.access.reports
Rick Brandt
external usenet poster
 
Posts: 4,354
Default 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  
Old September 7th, 2007, 02:34 PM posted to microsoft.public.access.reports
NetworkTrade
external usenet poster
 
Posts: 825
Default 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  
Old September 7th, 2007, 05:36 PM posted to microsoft.public.access.reports
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old September 8th, 2007, 02:50 PM posted to microsoft.public.access.reports
NetworkTrade
external usenet poster
 
Posts: 825
Default 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  
Old September 9th, 2007, 11:35 PM posted to microsoft.public.access.reports
Larry Linson
external usenet poster
 
Posts: 3,112
Default 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  
Old September 10th, 2007, 04:04 PM posted to microsoft.public.access.reports
Klatuu
external usenet poster
 
Posts: 7,074
Default 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

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 09:40 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.