So I am trying to pull some title information to update a couple fields in on of my tables, but when I try to create a dataset, Access seems to think there is not data (it tells me either BOR or EOF is true, when I try to rs.MoveFirst). I have also tried to do a record count (i.e., If rs.recordcount > 0 Then...), but that also evaluates my strSQL as having no records...
But in my watch window I can copy the variable strSQL and dump that into a new query and it shows 105 records. So why does Access keep telling me there are no records?
Here's my code:
What am i doing wrong here?
But in my watch window I can copy the variable strSQL and dump that into a new query and it shows 105 records. So why does Access keep telling me there are no records?
Here's my code:
Code:
Dim db As Database
Dim strSQL, strCheck, strOptionalIDCheck As String
Dim intTemplateType As Integer
Dim rs As ADODB.Recordset
'----------------------------------------------------------------------------------------------------------------------
' This function will denote the level of SAMS Prvileges. By Division.
'----------------------------------------------------------------------------------------------------------------------
Set db = CurrentDb
Set rs = New ADODB.Recordset
strSQL = "SELECT Services_Title, Optional_Indentifier From AGREEMENT " & _
"WHERE (Services_Title Like " & Chr(34) & Chr(42) & "MASTER" & Chr(42) & Chr(34) & " " & _
"OR Services_Title Like " & Chr(34) & Chr(42) & "Template" & Chr(42) & Chr(34) & ") ;"
With rs
.ActiveConnection = CurrentProject.Connection
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open (strSQL)
End With
If Not (rs.BOF And rs.EOF) Then... 'do Something
What am i doing wrong here?