Opening ADO.Recordsets

J

John H W

I am getting error 3709: "Operation is not allowed on an object referencing a
closed or invalid connection" when I try to open a recordset. I get the error
on the line that starts with an '>."

Function follows:
Public Function CheckEmployment(ByVal dtIntroDate As Date) As Boolean
Dim lJASID As Long
Dim strQuery As String
Dim rst As ADODB.Recordset

lJASID = WorkFirstCode.GetJASID()

strQuery = "SELECT * FROM Employment " & _
"WHERE JASID=" & CStr(lJASID) & " _
AND IntroDate=#" & CStr(dtIntroDate) & "#;"
Set rst = New ADODB.Recordset
rst.Open (strQuery)

If rst!JASID = CStr(lJASID) And rst!IntroDate = CStr(dtIntroDate) Then
CheckEmployment = True
Else
CheckEmployment = False
End If

"Employment" is the name of the table (in the same database) that I am
trying to open.

Thanks for any ideas.

John H W
rst.Close

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top