S
S Jackson
I have a dialog form that enables the user to search for a record. I want a
message box to come up telling the user how many records were found, or if
no records were found. Here is my code so far that does not work:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaster"
stLinkCriteria = "[CaseName]Like" & "'" & Me![txtSearch] & "*" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
If stDocName.RecordsetClone.RecordCount = 0 Then
DoCmd.Close
MsgBox "No records found - Please try again."
Else
stDocName.RecordsetClone.MoveLast
MsgBox "The database found " _
& stDocName.RecordsetClone.RecordCount _
& " case(s).", vbInformation, "Record Count"
End If
Of course, I am getting an error that says "Invalid qualifier" because the
variable is out of scope (I think). How do I rearrange all this to work?
TIA
S Jackson
message box to come up telling the user how many records were found, or if
no records were found. Here is my code so far that does not work:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMaster"
stLinkCriteria = "[CaseName]Like" & "'" & Me![txtSearch] & "*" & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
If stDocName.RecordsetClone.RecordCount = 0 Then
DoCmd.Close
MsgBox "No records found - Please try again."
Else
stDocName.RecordsetClone.MoveLast
MsgBox "The database found " _
& stDocName.RecordsetClone.RecordCount _
& " case(s).", vbInformation, "Record Count"
End If
Of course, I am getting an error that says "Invalid qualifier" because the
variable is out of scope (I think). How do I rearrange all this to work?
TIA
S Jackson