CreganTur
03-27-2008, 09:43 AM
I've got a form that will be used to search records by an account number, and then display matching fields ([CDate], [RCD], and [FNotes]).
I've got it setup so that the search works- when an account number is entered into the field (and user hits enter) the correct record appears. I'm using this code:
Dim rs As Recordset
Set rs = Me.Recordset.Clone
rs.FindFirst "[AcctNmbr] = '" & Me![Text4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
First problem:
I want a MsgBox to appear if the user enters an invalid account number. I tried using this directly after the "If Not" statement in the above code, but I get an error message stating that there's an "Else without an If"
Else
MsgBox "There are no results for the specified account number." & vbCrLf & _
"Please enter a different account number.", vbExclamation + vbOKOnly, "No Results"
End If
Second problem:
I want the form, On Open, to be blank. Currently, On Open, the [CDate],[RCD], and [FNotes] fields are all showing data that matches the first record of the query that's providing the data.
Any ideas? :help
I've got it setup so that the search works- when an account number is entered into the field (and user hits enter) the correct record appears. I'm using this code:
Dim rs As Recordset
Set rs = Me.Recordset.Clone
rs.FindFirst "[AcctNmbr] = '" & Me![Text4] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
First problem:
I want a MsgBox to appear if the user enters an invalid account number. I tried using this directly after the "If Not" statement in the above code, but I get an error message stating that there's an "Else without an If"
Else
MsgBox "There are no results for the specified account number." & vbCrLf & _
"Please enter a different account number.", vbExclamation + vbOKOnly, "No Results"
End If
Second problem:
I want the form, On Open, to be blank. Currently, On Open, the [CDate],[RCD], and [FNotes] fields are all showing data that matches the first record of the query that's providing the data.
Any ideas? :help