473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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
Nov 13 '05 #1
2 1946
rkc

"Roberta" <rh*****@dhs.state.ia.us> wrote in message
news:cc**************************@posting.google.c om...
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.


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'.

Nov 13 '05 #2
rkc:

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

Roberta
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: news.microsoft.com | last post by:
hey all, I am having an odd problem with the InputBox in VB.NET, and it ONLY happens on one of my computers. When I try "Dim x as String = InputBox("TESTPROMPT"), I get the following error: ...
1
by: tony wong | last post by:
i have a html form to select fax number. i wish to post the fax numbers at such layout (123456;234567;34567) to the inputbox at other html page. Can i do it? Thanks a lot. Tony
5
by: adolf garlic | last post by:
Im trying to return xml from sql. The xml is made up of different fragments, some using FOR XML ... syntax. The result is a valid xml doc. There is a working stored proc that returns the xml In...
4
by: Pea | last post by:
Hello, I have a nicely running report (thanks to Reggie and others) which I've been asked to modify to prompt for the Month (a monthly report to be run). I used an InputBox command: ...
1
by: Hans Kamp | last post by:
How do I use InputBox? private void addButton_Click(object sender, System.EventArgs e) { string newName; newName = InputBox("t1", "t2", "t3"); namesListBox.Items.Add(newName); }
1
by: | last post by:
When trying to use the InputBox function I get the error "InputBox is a namespace and therefore is not a valid expression". Can anyone tell me what the problem is? Thanks.
1
by: stan | last post by:
The SQL below worked in Access 95 (V 7) is not working in the current version (V 2003). What is supposed to happen: 1) From my form I hit a button that calls an input box. 2) Underlying...
8
by: jpoquette | last post by:
I have recently upgraded a Visual Basic 2003 win forms application to 2005. After doing so I can no longer get my project to compile. The code is bombing on any line that uses an InputBox. I'm...
5
by: Dakrat | last post by:
Allow me to preface this post by saying that this is my first database project, and while I have learned a lot, any concepts I have learned are hit and miss as I have found new requirements and...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.