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

what should I add to event procedure to activate FIND command button?

P: 4
What should I add to event procedure to activate FIND command Button in Access 2000.
I created a Find (command Button) on a created Form but I can't activate it.
Aug 26 '08 #1
Share this Question
Share on Google+
5 Replies


100+
P: 167
In the OnClick event for your command button put:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.FindRecord
Now hit SPACE to open the context...
Aug 26 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
To search the last field your cursor was in, goto Tools - Options - Edit/Find and set Default Find/Replace to Fast Search, then

Expand|Select|Wrap|Line Numbers
  1. Private Sub SearchButton_Click()
  2.  Screen.PreviousControl.SetFocus
  3.  DoCmd.RunCommand acCmdFind
  4. End Sub
To search all fields, omit the line

Screen.PreviousControl.SetFocus

Welcome to Bytes

Linq ;0)>!
Aug 26 '08 #3

P: 4
Thank you for your answer, I insert the line code that you sent it to me in ONCLICK event tab of FIND command button but it gives me an error :Access failed to evaluate one or more expression because "docmd" was referenced in an expression".
The place I insert the code is in properties of Find Button - in front of Onclick in Event tab, I delete "event procedure" and put "DoCmd.FindRecord" instead.
Is that right whatever I did and how can I fix this error?

Thanks
Aug 27 '08 #4

100+
P: 167
Thank you for your answer, I insert the line code that you sent it to me in ONCLICK event tab of FIND command button but it gives me an error :Access failed to evaluate one or more expression because "docmd" was referenced in an expression".
The place I insert the code is in properties of Find Button - in front of Onclick in Event tab, I delete "event procedure" and put "DoCmd.FindRecord" instead.
Is that right whatever I did and how can I fix this error?

Thanks
You really are new:-)
Ok, goo to that sam property where the [event procedure] was.
Put a cursor in it to get little button on the side with three dots on it.
Click that button to open pop-up and select Code builder.
Now you're in the OnClick event of that button and write the code
DoCmd.FindRecord....
Aug 27 '08 #5

missinglinq
Expert 2.5K+
P: 3,532
And just to be clear, are you trying to do this on a form or on a web page? Your original thread on the question said PAGE.

Linq ;0)>
Aug 27 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.