when I try and connect to this database I get the same error everytime. Invalid use of a New Key Word for the "New Connection" How can I correct this?
Private Sub Form_Load()
Dim Treespraying As Connection
Set Treespraying = New Connection
Treespraying.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\TreeSpraying.mdb"
Set adoRecordset = New Recordset
adoRecordset.OpenRecordset "Select CustomerLastName, CustomerFirstName", Treespraying, adOpenStatic, adLockOptimistic
Set txtCustomerLastName.DataSource = adoRecordset
txtCustomerLastName.DataField = "CustomerLastName"
Set txtCustomerFirstName.DataSource = adoRecordset
txtCustomerFirstName.DataField = "CustomerFirstName"
End Sub
Private Sub Form_Load()
Dim Treespraying As Connection
Set Treespraying = New Connection
Treespraying.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\TreeSpraying.mdb"
Set adoRecordset = New Recordset
adoRecordset.OpenRecordset "Select CustomerLastName, CustomerFirstName", Treespraying, adOpenStatic, adLockOptimistic
Set txtCustomerLastName.DataSource = adoRecordset
txtCustomerLastName.DataField = "CustomerLastName"
Set txtCustomerFirstName.DataSource = adoRecordset
txtCustomerFirstName.DataField = "CustomerFirstName"
End Sub