Link to home
Start Free TrialLog in
Avatar of LUIS FREUND
LUIS FREUND

asked on

Populating Cells in excel using a combo box in excel from an access table or query.

What I'm trying to accomplish is getting data from a table in Access to Excel only populating certain cells within an Excel Sheet by selecting the Supplier Name from a drop down box that user selects.  The Combo Box selection is in the Excel file.

 I have a database called Supplier

 For example: Table Called Supplier.  When the user selects a Supplier name it populates the following:

 Supplier_Name to cell B3
 Supplier_Address to cell B4
 Supplier_City to cell B5
 Supplier_ST to cell C5
 Supplier_Zip to cell B6
 Supplier_POC to cell B9
 Supplier_Phone to cell B12
 Supplier_Fax to cell B15

 The Excel file is called RFQ:  

 See attached files

C--Users-Luis.Freund.EXT-Desktop-E.accdb
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsx
Avatar of PatHartman
PatHartman
Flag of United States of America image

Since the sheet you want to populate is not a "table", then you have to use OLE automation.  That means you need to write VBA code to open Excel and update each cell one at a time.  You can't use TransferSpreadsheet.
Please find the attached with a drop down in cell B3 on Sheet1.
The code assumes that the database C--Users-Luis.Freund.EXT-Desktop-E.accdb is saved at your desktop.
So once you select a name from the drop down in B3, the code will retrieve the relevant data on the AccessData sheet and the formulas on Sheet1 will return all the data from AccessData sheet.
The third sheet is called List contains a list of suppliers which is used as a source for validation list in B3 on Sheet1.

See if this is what you were trying to achieve.

Note: This is a macro-enabled workbook so you will need to enable the macros while prompted.
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsm
Avatar of LUIS FREUND
LUIS FREUND

ASKER

AWESOME.......

I added more records to the DB and added the supplier name to sheet3 but on the dropdown box I'm not seeing the new suppliers I added.

any ideas?
Okay. Please find the attached and just add suppliers names on List sheet starting from A2 and all the names would be visible in the drop down list in B3 on Sheet1.
C--Users-Luis.Freund.EXT-Desktop-Ex.xlsm
THIS IS GREAT!   Another quick question....how did you create the combo box and link it to the list?
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial