parameters using docmd.openreport

  • Thread starter Thread starter seeker
  • Start date Start date
S

seeker

The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value

Klatuu said:
Where do you initially get the parameter values?


--
Dave Hargis, Microsoft Access MVP


seeker said:
The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
I am not quite sure why you are not getting the parameters. The only thing I
see is that you don't need to use the Value property (it is the default) and
you should always qualify you control names with the form reference. I would
write it as:

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = """ & Me.LastName & """ and [First Name] = """ & Me.FirstName & """"

--
Dave Hargis, Microsoft Access MVP


seeker said:
from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value

Klatuu said:
Where do you initially get the parameter values?


--
Dave Hargis, Microsoft Access MVP


seeker said:
The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
Thank you for your reply. After initiating your suggestion, when I execute
the button to run the report it is still asking for [Last Name] and [First
Name].

Klatuu said:
I am not quite sure why you are not getting the parameters. The only thing I
see is that you don't need to use the Value property (it is the default) and
you should always qualify you control names with the form reference. I would
write it as:

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = """ & Me.LastName & """ and [First Name] = """ & Me.FirstName & """"

--
Dave Hargis, Microsoft Access MVP


seeker said:
from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value

Klatuu said:
Where do you initially get the parameter values?


--
Dave Hargis, Microsoft Access MVP


:

The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
I think it just dawned on me what the problem is. It sounds like you have
those parameters identifed in the report's recordset query. Take them out.
When using the Where argument of the OpenReport method, you don't put the
parameters in the query.
--
Dave Hargis, Microsoft Access MVP


seeker said:
Thank you for your reply. After initiating your suggestion, when I execute
the button to run the report it is still asking for [Last Name] and [First
Name].

Klatuu said:
I am not quite sure why you are not getting the parameters. The only thing I
see is that you don't need to use the Value property (it is the default) and
you should always qualify you control names with the form reference. I would
write it as:

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = """ & Me.LastName & """ and [First Name] = """ & Me.FirstName & """"

--
Dave Hargis, Microsoft Access MVP


seeker said:
from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value

:

Where do you initially get the parameter values?


--
Dave Hargis, Microsoft Access MVP


:

The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
Thanks worked beautifully. I changed the parameters in the title to lastname
and firstname which are fields in the query and it works beautifully.

Klatuu said:
I think it just dawned on me what the problem is. It sounds like you have
those parameters identifed in the report's recordset query. Take them out.
When using the Where argument of the OpenReport method, you don't put the
parameters in the query.
--
Dave Hargis, Microsoft Access MVP


seeker said:
Thank you for your reply. After initiating your suggestion, when I execute
the button to run the report it is still asking for [Last Name] and [First
Name].

Klatuu said:
I am not quite sure why you are not getting the parameters. The only thing I
see is that you don't need to use the Value property (it is the default) and
you should always qualify you control names with the form reference. I would
write it as:

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = """ & Me.LastName & """ and [First Name] = """ & Me.FirstName & """"

--
Dave Hargis, Microsoft Access MVP


:

from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value

:

Where do you initially get the parameter values?


--
Dave Hargis, Microsoft Access MVP


:

The following code is executed when a button on a form is clicked;

DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"

[Last Name] and [First Name] are parameters in the query that the report is
based. I want data passed to those parameters when the report is opened by
the button. I also have these parameters in the title of the report so they
are needed in the query. I want the report to run without the parameter
asking for data.
 
Thanks worked beautifully.  I changed the parameters in the title to lastname
and firstname which are fields in the query and it works beautifully.



Klatuu said:
I think it just dawned on me what the problem is.  It sounds like youhave
those parameters identifed in the report's recordset query.  Take them out.  
When using the Where argument of the OpenReport method, you don't put the
parameters in the query.
Thank you for your reply.  After initiating your suggestion, when Iexecute
the button to run the report it is still asking for [Last Name] and [First
Name].
:
I am not quite sure why you are not getting the parameters.  The only thing I
see is that you don't need to use the Value property (it is the default) and
you should always qualify you control names with the form reference..  I would
write it as:
  DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = """ & Me.LastName & """ and [First Name] = """ & Me.FirstName & """"
--
Dave Hargis, Microsoft Access MVP
:
from textboxes in the same form that the button to execute the report is
found thus lastname.value and firstname.value
:
Where do you initially get the parameter values?
--
Dave Hargis, Microsoft Access MVP
:
The following code is executed when a button on a form is clicked;
  DoCmd.OpenReport "rptOutreachDoneMemberSelect", acViewPreview, , "[Last
Name] = '" & LastName.Value & "' and [First Name] = '" & FirstName.Value & "'"
[Last Name] and [First Name] are parameters in the query thatthe report is
based.  I want data passed to those parameters when the report is opened by
the button.  I also have these parameters in the title of the report so they
are needed in the query.  I want the report to run without the parameter
asking for data.- Hide quoted text -

- Show quoted text -

Hi,
I have the same problem but I didn't understand what you meen to take
the parameters out.
Thank for explain that, Sara
 
Back
Top