Macro for search button (1 Viewer)

gary g

Registered User.
Local time
Today, 10:57
Joined
Jul 4, 2009
Messages
38
(Access 2007). I am having trouble creating a macro for a search button I want to place on my form. I want users to be able to click the button and then search for a specific record in the database based on the criteria of that particular field.

Form Name= frmInventory
Text Field= HPDNo (this field consists of a unique 5 digit identifier for each record in the table)

I tried creating the following macro for the button -
Action: SearchForRecord
Object Type: Form
Object Name: frmInventory
Record: First
Where Condition: ="HPDNo = ' " & Forms ! [frmInventory] ! [HPDNo] & " ' "
(the Where syntax came from the help file in Access)

When I click the button on the form, nothing happens. Any idea what I may be doing wrong? Thanks for anyone's input.
 

NickHa

CITP
Local time
Today, 16:57
Joined
Jan 29, 2012
Messages
203
Have you linked the macro to the command button's Click event? With the form in design view, select the button and look at its properties. In the Events tab, the top entry is the Click event and from the drop-down box, you can select your macro name.
If you have this set up already, then please post further details of the button properties and the macro (screenshots would be helpful).
 

ASAD-BAGHDAD

New member
Local time
Today, 18:57
Joined
Jan 4, 2012
Messages
2
Only replace the Action to FindRecord Action
And then use the arguments in the action argument section to the Macro window and chang the options as you like

Thnks for All
 

Users who are viewing this thread

Top Bottom