Using Access Data In Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'd like to create a form in Excel with combo boxes that get their data from
Access tables. I posted this question over at the Excel programming
newsgroup, but nobody's answered. Does anyone know how to do this?

Thank you.
Sprinks
 
Use ADO to get a recordset and use it to populate unbound textboxes. Also you
can make combo boxes that when clicked and use ADO movement commands to
navigate.
 
I'm no expert on Excel programming, but this passed a very brief test. I
used DAO, you could of course use ADO if you prefer, just remember to add a
reference to the relevant object library ...

Private Sub UserForm_Click()

Dim db As DAO.Database
Dim rst As DAO.Recordset

'Make sure you save the workbook before testing this, otherwise
ThisWorkbook.Path returns an empty string.
'Assumes the MDB is in same folder as workbook.
Set db = DAO.OpenDatabase(ThisWorkbook.Path & "\northwind.mdb")

Set rst = db.OpenRecordset("SELECT CategoryName FROM Categories ORDER BY
CategoryName")
Do Until rst.EOF
Me.ComboBox1.AddItem rst.Fields("CategoryName").Value
rst.MoveNext
Loop
rst.Close

End Sub
 
Thanks for the assist, visdev1.

visdev1 said:
Use ADO to get a recordset and use it to populate unbound textboxes. Also you
can make combo boxes that when clicked and use ADO movement commands to
navigate.
 
Back
Top