I'm passing in an Openargs and trying to use that as a filter for the recordsource for the form. This works fine on other forms with the same setup. For some reason though, this isn't working on this one.
Private Sub Form_Load()
Dim sSQL As String
sSQL = "SELECT * " & _
"FROM tblUserList " & _
"WHERE NTID='" & OpenArgs & "';"
RecordSource = sSQL
If IsNull(Manager) Then
MsgBox "Returned 0 records", vbCritical, "Problem"
Exit Sub
End If
End Sub
If I step through the code, the Openargs is passed in correctly...the SQL string is created correctly, I can run the string from the Query builder and I get a single record returned...as I would expect.
However, when the form loads, it returns 0 records and obviously that's a problem...I put in the IF to catch it before it hits the rest of my code.
Debug.Print sSQL
give? – AndreMe.RecordSource
, because everyone knows at once that it is the form property and not some variable. – Andre