I am getting the above error when I load my form.
' Connect the Data control to the database.
datAssetsDrop.DatabaseName = dbname
Here is the code:
Private Sub Form_Load()
Dim dbname As String
Dim db As dao.Database
Dim rs As dao.Recordset
' Open the database.
dbname = "C:\Documents and Settings\Renee McCown\My Documents\Mylan\Equipment Application\Mylan NODBMenu"
If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
dbname = dbname & "Mylan_NODBMenus.mdb"
Set db = OpenDatabase(dbname)
Set rs = db.OpenRecordset("SELECT AssetsDrop.[PONumber] FROM AssetsDrop ORDER BY AssetsDrop.[PONumber]", dbOpenSnapshot)
' Load the ComboBox.
rs.MoveFirst
Do While Not rs.EOF
PONumber.AddItem rs!PONumber
rs.MoveNext
Loop
rs.Close
db.Close
' Connect the Data control to the database.
datAssetsDrop.DatabaseName = dbname
Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.
' Connect the Data control to the database.
datAssetsDrop.DatabaseName = dbname
Here is the code:
Private Sub Form_Load()
Dim dbname As String
Dim db As dao.Database
Dim rs As dao.Recordset
' Open the database.
dbname = "C:\Documents and Settings\Renee McCown\My Documents\Mylan\Equipment Application\Mylan NODBMenu"
If Right$(dbname, 1) <> "\" Then dbname = dbname & "\"
dbname = dbname & "Mylan_NODBMenus.mdb"
Set db = OpenDatabase(dbname)
Set rs = db.OpenRecordset("SELECT AssetsDrop.[PONumber] FROM AssetsDrop ORDER BY AssetsDrop.[PONumber]", dbOpenSnapshot)
' Load the ComboBox.
rs.MoveFirst
Do While Not rs.EOF
PONumber.AddItem rs!PONumber
rs.MoveNext
Loop
rs.Close
db.Close
' Connect the Data control to the database.
datAssetsDrop.DatabaseName = dbname
Homer: But every time I learn something new, it pushes out something old! Remember that time I took a home wine-making course and forgot how to drive?
Marge Simpson: That's because you were drunk!
Homer: And how.