LysaTigger
Technical User
Hi,
I am connecting to an access database through ADODB. The connection is working and I can retrieve data from the recordset.
Now I would like to be able to view the field names from the database that I am connecting to in a combobox in a form.
Here is the code I have so far.
Dim adoConn As ADODB.Connection
Dim adoRst As ADODB.Recordset
Dim fld As ADODB.Field
'Open a DB Connection
Set adoConn = New ADODB.Connection
adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=L:\COMMON\GIS\Avian Influenza\Databases\PHEMS_TestDB.mdb;"
'Open a recordset
Set adoRst = New ADODB.Recordset
adoRst.Open "tblEventSummary", adoConn, adOpenDynamic, adLockOptimistic
adoRst.Close
adoConn.Close
Set adoRst = Nothing
Set adoConn = Nothing
The combox name is cmbUniqueID.
Thanks.
Lysa
I am connecting to an access database through ADODB. The connection is working and I can retrieve data from the recordset.
Now I would like to be able to view the field names from the database that I am connecting to in a combobox in a form.
Here is the code I have so far.
Dim adoConn As ADODB.Connection
Dim adoRst As ADODB.Recordset
Dim fld As ADODB.Field
'Open a DB Connection
Set adoConn = New ADODB.Connection
adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=L:\COMMON\GIS\Avian Influenza\Databases\PHEMS_TestDB.mdb;"
'Open a recordset
Set adoRst = New ADODB.Recordset
adoRst.Open "tblEventSummary", adoConn, adOpenDynamic, adLockOptimistic
adoRst.Close
adoConn.Close
Set adoRst = Nothing
Set adoConn = Nothing
The combox name is cmbUniqueID.
Thanks.
Lysa