Please help! Database lookup from excel

M

mju

I am trying to write a VBA program that will ask user to enter the company's
name in an input box.
it will then lookup an Access database to find matching company's name to
return company's ID.
ID number will be returned in an Excel spreadsheet in cell B1.Company's name
will be in cell A1.

Before Search:
Company 's name ID_Num
macy 's

After Search:

Company 's Name ID_num
macy 's 123
 
J

Joel

jThe best way is first ot manual do the operation while record a macro and
then modify the record macro as required.


1) From worksheet menu start recording macro - Tool - Macro Record New Macro
2) Perform the query from Data - Import External Data - New Database query.
Select the database file. then select the two Company and ID.

3) If yo can't modify the code yourself post the code so it can be modified.
 

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