Search For Field

Prince

Registered User.
Local time
Today, 22:41
Joined
Oct 2, 2003
Messages
29
Good Morning
Two questions
1-I have created a text field form and to search for account number

which is
Dim N As Boolean
N = IsNull(Text40.Value)
If N = False Then
Me.Recordset.FindFirst "AccountNumber = " & Text40.Value

Else
MsgBox "You didn't Enter Account Number"
End If

I would like to add code taht displays to the user in case the account doesn't exist message diplaying
"This account number doesn't exist"

2- I have put the previous code in button. I tried to also to use it when the user press Enter Key but I didn't succeed. If anyone can help.

Thanks for any help
 
1)
A) I hope your not actually using Text40 as a fieldname in your db app? If you are... DONT... Use something more usefull! like in this case txtAccountNumber

B)
If IsNull(Text40.Value) Then
MsgBox "You didn't Enter Account Number"
else
Me.Recordset.FindFirst "AccountNumber = " & Text40.Value
endif
Will do the same but in a less roundabout way....

C)
If IsNull(Text40.Value) Then
MsgBox "You didn't Enter Account Number"
else
Me.Recordsetclone.FindFirst "AccountNumber = " & Text40.Value
if me.recordsetclode.nomatch then
msgbox "No match"
else
me.bookmark = me.recordsetclone.bookmark
endif
endif
Should do the trick for you....

2)
If IsNull(Text40.Value) Then
MsgBox "You didn't Enter Account Number"
else
Me.Recordsetclone.FindFirst "AccountNumber = " & Text40.Value
me.bookmark = me.recordsetclone.bookmark
endif
I am not completely sure but i think you have to search in the recordsetclone and cannot do it directly in the recordset....

Regards

The Mailman
 
Thank u
 

Users who are viewing this thread

Back
Top Bottom