Drop Down List resulting in compile error

Bodhisattva

New member
Local time
Yesterday, 17:57
Joined
Aug 27, 2009
Messages
1
Hello,

I've imported an old database (made in maybe Access 95/97) in 2007.

It all works perfectly except on the donations form which has two drop down lists, when you select something fromt he dropdown it results in a compile (it works fine in the original version)

This is what it highlights:

Private Sub txtPurpose_AfterUpdate()

Dim CheckR As New Recordset
CheckR.Open _
"Select * from lkptblDonationPurpose Where txtPurpose = '" & Me.txtPurpose & "'", _
CurrentProject.Connection
Me.txtReceipt = CheckR!txtReceipt

End Sub



As far as i can tell it checks the table with the names and displays them in the dropdown list.

Any idea why it is not working?

Thanks in advance,

James

P.S The error says:'Invalid Use of New Keyword'
 
Last edited:
Change this:
Dim CheckR As New Recordset

to this

Dim CheckR As New ADODB.Recordset

And you will need to set a reference to ADO in references if you are going to use ADO.
 

Users who are viewing this thread

Back
Top Bottom