Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 12:57 AM
Roberta
Guest
 
Posts: n/a
Default Use result from Inputbox in query

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
Default 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
Default Re: Use result from Inputbox in query

rkc:

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

Roberta
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles