By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

Search in specific field on form does not work.

P: n/a
I have a few buttons on my form to search for text in a dedicated
field:
Private Sub CmdSearchA_Click()

On Error GoTo Err_Find_Record_Click

Me.CustomerID.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Find_Record_Click:
Exit Sub

Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click

End Sub

However, if the text is not found in the 600 records I have (or found,
but I choose "Find Next") then it start looking for the same text in
another field after all specific fields has been screened. It should
start again with the first reord, if "All" is set in the search
options. How to solve this irritating problem?

Bart
Acc 2003

Oct 18 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hello Bart,

"AA Arens" wrote...
>I have a few buttons on my form to search for text in a dedicated
field:
Private Sub CmdSearchA_Click()

On Error GoTo Err_Find_Record_Click

Me.CustomerID.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Find_Record_Click:
Exit Sub

Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click

End Sub

However, if the text is not found in the 600 records I have (or found,
but I choose "Find Next") then it start looking for the same text in
another field after all specific fields has been screened. It should
start again with the first reord, if "All" is set in the search
options. How to solve this irritating problem?
try this:
Dim varInput
Me.customerID.Setfocus
varInput=InputBox("What do you want me to find?","Need more input...")
DoCmd.FindRecord varInput, acEntire, , acSearchAll, False, acCurrent
regards

Michael
Oct 18 '06 #2

P: n/a
Thanks Michel, it works fine.

My side question is, it is not possible to use wildcards. How to make
that possible?

Another question, is it possible to have a Find Next feature added?

Bart

On Oct 18, 8:54 pm, "Michael Theymann" <e...@maithai.dewrote:
Hello Bart,

"AAArens" wrote...
I have a few buttons on my form to search for text in a dedicated
field:
Private Sub CmdSearchA_Click()
On Error GoTo Err_Find_Record_Click
Me.CustomerID.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
However, if the text is not found in the 600 records I have (or found,
but I choose "Find Next") then it start looking for the same text in
another field after all specific fields has been screened. It should
start again with the first reord, if "All" is set in the search
options. How to solve this irritating problem?try this:
Dim varInput
Me.customerID.Setfocus
varInput=InputBox("What do you want me to find?","Need more input...")
DoCmd.FindRecord varInput, acEntire, , acSearchAll, False, acCurrent

regards

Michael
Oct 20 '06 #3

P: n/a
Hi Bart,

"AA Arens" wrote...
My side question is, it is not possible to use wildcards. How to make
that possible?

Another question, is it possible to have a Find Next feature added?
However, if the text is not found in the 600 records I have (or found,
but I choose "Find Next") then it start looking for the same text in
another field after all specific fields has been screened. It should
start again with the first reord, if "All" is set in the search
options. How to solve this irritating problem?try this:
>Dim varInput
Me.customerID.Setfocus
varInput=InputBox("What do you want me to find?","Need more input...")
DoCmd.FindRecord varInput, acEntire, , acSearchAll, False, acCurrent

try this instead:

DoCmd.FindRecord varInput, acAnywhere, , acDown, False, acAll

Now you can set varInput to a part of the searchstring (e.g. "amount of" to
find "the amount of money" as well as "the amount of cars"), this is used
instead of wildcards.

"acDown" makes Access to search from the point where you are. "acSearchAll"
(as in my first example) searches every record, starting from record 1. If
you first use "acSearchAll" and then only "acDown", Access will go to the
next record instead of showing the same one everytime.

Yours

Michael
Oct 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.