jsmith1611
Registered User.
- Local time
- Today, 15:17
- Joined
- Jan 7, 2009
- Messages
- 23
I am trying to set a label caption to an error message when searching for a record in a form. Basically I am setting a bookmark on the form based on a text field. Here is my vb code:
If DCount("[last]", "query_letters") = 0 Then
lblMember.Caption = "Member not found."
Else
lblMember.Caption = ""
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "acct = " & member
Me.Bookmark = rst.Bookmark
End If
query_letters is the record source for my form.
The code works as far as finding a good record, but if the record does not exist, the error message is not being displayed in the caption. I have used this method successfully for other queries when I am opening a new form, but in this case I am opening the record in the same form. I suspect my problem has something to do with that. Any help will be greatly appreciated.
Thanks,
Josh
If DCount("[last]", "query_letters") = 0 Then
lblMember.Caption = "Member not found."
Else
lblMember.Caption = ""
Dim rst As Recordset
Set rst = Me.RecordsetClone
rst.FindFirst "acct = " & member
Me.Bookmark = rst.Bookmark
End If
query_letters is the record source for my form.
The code works as far as finding a good record, but if the record does not exist, the error message is not being displayed in the caption. I have used this method successfully for other queries when I am opening a new form, but in this case I am opening the record in the same form. I suspect my problem has something to do with that. Any help will be greatly appreciated.
Thanks,
Josh