View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Please help! Database lookup from excel

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.

"mju" wrote:

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