Excel link to Access: Getting value of selected name into sql query

T

tradebanker

In Excel XP, I am importing data from Access via Data>>Import External
Data, browsing to the database and table, and editing the query to get
just the fields I want. The selection values are in a dropdown list
from the same database.

I need to get the selected value from the drop down list into the sql
statement below to replace "testVendor". I have assigned the name
VendorName to the drop down cell, but do not know how to refer to it's
value in the sql statement. Any help on the syntax?

Select Part_Number, UPC_Code, Description FROM Combined_UPC_Codes
WHERE Vendor_Name = "testVendor"
 
B

Bill James

It depende on where your control is located. On a form?

You can use (from within the form module):

Me.VendorName

Or:

Forms![MyFormName]![VendorName]

Where MyFormName would be replaced with the name of your
form that holds the control VendorName. Both obviously
would require the form to be loaded (open).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top