I have a combo box to list data from a spreadsheep. Can I use ADO connection and recordset to SQL data from a excel spreadsheep? If so, what is the syntex?
Thanks in advance.
I have a combo box to list data from a spreadsheep. Can I use ADO connection and recordset to SQL data from a excel spreadsheep? If so, what is the syntex?
Thanks in advance.
Are you trying to update Access from Excel?
Do you want to update Access with a combo range, or something else?
Last edited by Bob Phillips; 09-23-2008 at 05:19 AM.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Yes, I'm trying to update a combo box in Access with the data from Excel.Originally Posted by xld
Thanks.
Should be a matter of opening up a connection object to the worksheet that contains the data, then populating the combo box with additem() assuming you have created an Access form.Originally Posted by dhartford
There is no use in proceeding unless you can verify the Excel data can be queried in ADO. No use guessing at that, best if you could attach a sample of the Excel data. .02 Stan
It is simple to to use ADO to query Excel, and you can always retrieve the data intoan array, and load the combo with the array.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Here's one approach. Let's say I have an external Excel spreadsheet, where the first page contains a list of items I want to use to populate the dropdown.
In Access, I select File/Get External Data/Link Tables
In the dialog box, I select the Excel file type from the dropdown and point to the Excel file.
I now have a link table in Access that points to the Excel sheet. Now, I can write a simple query for it, and then use that query as the source for the dropdown.
If this works for you, there's no need to use ADO or recordset. The Access link will take care of it.
S
Thank you for your reply. But I don't want user to view the data in spreadsheet, so can't link the spreadsheet in.Originally Posted by Slyboots
You don't want the user to view the data from the spreadsheet?
dhartford,
take a look at my response to your listbox problem. You can use everything I provided for your listbox to populate your combobox with data- you just need to reference the correct object.
-Randy Shea
I'm a programmer, but I'm also pro-grammar!
If your issue is resolved, please use Thread Tools to mark your thread as Solved!
PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003