Here’s my code. I hope someone can help.
Dim Connxn As ADODB.Connection
Dim rst As ADODB.Recordset
Set Connxn = CurrentProject.Connection
Set rst = New ADODB.Recordset
strCriteria = “SELECT * FROM tblCompoundAssignments WHERE [tblCompoundAssignments].[Compound] = ‘” & Me.CompoundNo & “‘”
rst.Open strCriteria, Connxn, adOpenDynamic, adLockPessimistic, adCmdTable
I get the error message on the rst.Open line. What am I doing wrong?
Things were okay until I tried to add the WHERE clause. Earlier I was just opening the table and had added the line
rst.filter = “[Compound] = ” & me.compoundno
once the table was open, but it wasn’t actually performing the filter for some reason, so I thought it would be better to restrict the records up front.
Help!