Connecting Tech Pros Worldwide Help | Site Map

Use result from Inputbox in query

  #1  
Old November 13th, 2005, 12:57 AM
Roberta
Guest
 
Posts: n/a
Hello,

When I use the following code to print a report for a certain client,
it works fine:
DoCmd.OpenReport "rpt_MNMTSingleCover_Summary_Recommendations",
acPreview, "", "[qry_MNMTSingleCover_Summary_Recommendations]![strClientID]=[Enter
Client ID]"


But I want to run multiple reports for the same client without asking
for the client ID more than once so I tried the following code:
Dim clientid As String
clientid = InputBox("Enter Client ID")

DoCmd.OpenReport "rpt_MNMTSingleCover_Summary_Recommendations",
acPreview, "", "[qry_MNMTSingleCover_Summary_Recommendations]![strClientID]=clientid"

When I run this code it asks for the client ID OK but after I enter
the ID, I get another window that wants me to enter the parameter
value for clientid.


I would appreciate any help on this.
Thanks
Roberta
  #2  
Old November 13th, 2005, 12:57 AM
rkc
Guest
 
Posts: n/a

re: Use result from Inputbox in query



"Roberta" <rhastin@dhs.state.ia.us> wrote in message
news:cc6b0d09.0406180530.1b52233f@posting.google.c om...[color=blue]
> Hello,
>
> When I use the following code to print a report for a certain client,
> it works fine:
> DoCmd.OpenReport "rpt_MNMTSingleCover_Summary_Recommendations",
> acPreview, "",[/color]
"[qry_MNMTSingleCover_Summary_Recommendations]![strClientID]=[Enter[color=blue]
> Client ID]"
>
>
> But I want to run multiple reports for the same client without asking
> for the client ID more than once so I tried the following code:
> Dim clientid As String
> clientid = InputBox("Enter Client ID")
>
> DoCmd.OpenReport "rpt_MNMTSingleCover_Summary_Recommendations",
> acPreview, "",[/color]
"[qry_MNMTSingleCover_Summary_Recommendations]![strClientID]=clientid"[color=blue]
>
> When I run this code it asks for the client ID OK but after I enter
> the ID, I get another window that wants me to enter the parameter
> value for clientid.[/color]

Save the result of the inputbox to a textbox control on the form and then
reference the textbox control in your Where Condition. An example of
the syntax can be found in help under 'OpenReport Action'.



  #3  
Old November 13th, 2005, 12:58 AM
Roberta
Guest
 
Posts: n/a

re: Use result from Inputbox in query


rkc:

Thank you very much for your prompt response. The code worked great!
Thanks!!!

Roberta
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
4 different questions. Jacky11 answers 5 November 12th, 2005 02:23 PM