Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass parameter to query - is it possible?

Status
Not open for further replies.

buddyel

MIS
Mar 3, 2002
279
US
I have designed a form which displays Vendor information and the forms have buttons which display pre-existing queries, however it displays all records in the query not just the results for a particular vendor. I'd like to be able to take the VendorID value on the current record and pass that along to the query to have it only display records for this particular vendor. Is this possible?
 
Thanks for your help but when I click the button it is now prompting for a parameter. Here is the query, can you tell me what I am doing wrong?

SELECT CircuitMaster.PhoneNo, CircuitMaster.DNIS, CircuitMaster.Status, CircuitMaster.Use, CircuitMaster.Notes
FROM CircuitMaster
WHERE (((CircuitMaster.ClassOfService)="DID") And ((CircuitMaster.VendorID)=frmVoice!VendorID));
 
Just to be sure, is VendorID populated?

What I usually do is set up if statements, so that if in your case VendorID is not populated, it runs a query that doesn't include the VendorID constraint. When VendorID is not null, it would run your query above.

if VendorID is populated, what parameter is it asking for? Because assuming that your form and control names are correct, you should not have a problem with that piece of the query.

Hope this helps,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
WHERE ClassOfService = 'DID' AND VendorID = [Forms]![frmVoice]![VendorID];

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top