How do I populate a combobox with Field names
from an Access DB Table? I can do it with Records from the field but I can't figure out how to get the Field names.
Set dbEquipSetF1 = OpenDatabase("C:\Program Files\PageMe\Pageme.mdb")
Set rstEquipSetF1 = dbEquipSetF1.OpenRecordset("EquipmentSetF1", dbOpenDynaset)
With rstEquipSetF1
Do While Not .EOF
cboEquipSet.AddItem .Fields
.MoveNext
Loop
End With
I'm not even close...
Thanks
Relentless
Re: How do I populate a combobox with Field names
Well you could use DAO in vb too, but if you want to use ADO, you can use ADOX:
http://www.codeguru.com/forum/showth...hreadid=203405
JeffB
Re: How do I populate a combobox with Field names
Thanks for the suggestion, Jeff, but I'm using VB5 and I don't think it supports ADO.
Rel
Re: How do I populate a combobox with Field names
Ok, sry I kinda looked your code a bit quick. You don't need a recordset at all, the FIELDS description is hold into the TABLEDEFS structure which is into the DATABASE object, for example, you can browse them like that:
Code:
Dim db As DAO.Database
Dim x As Integer
Set db = DAO.OpenDatabase("E:\bdtest.mdb")
For x = 0 To db.TableDefs("tbltext").Fields.Count - 1
Debug.Print db.TableDefs("tbltext").Fields(x).Name
Next x
db.Close
Set db = Nothing
JeffB
Re: How do I populate a combobox with Field names
Many thanks Jeff...I bow to your brilliance.
Rel