Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Record

Status
Not open for further replies.

bjarvis

Technical User
Jan 15, 2001
38
US
I've got a text box in a form called Part#. I would like to create a command button so that when the user clicks it a input box will show up and the user will be able to type in the part they're looking for and it will take them to that record. Any help would be appreciated.
 
Add an unbound combobox to your form's header(or footer). The wizard should launch (if the wizard wand is depressed on the toolbar). One of the options is to 'Find a record...'. Follow the wizard's instructions and you'll have a combobox that will give the user a list of parts and find the record for that part. (this assumes that the data is normalized properly and each part is a unique record)
 
Instead of a command button calling an input box you can have a command button call the Find Dialog box (the one with the Binoculars as an icon). Your code would look something like this:

Private Sub cmdSearchPart#_Click()

Me.Controls("Part#").SetFocus
SendKeys "%ha%n", False '** This line makes the find
' dialog box default to Match
' "Any Part Of Field". If you
' want the user to have to enter
' the exact Part#, leave this
' line out.
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

End Sub

I think this will get you what you want!! Good luck!!
 
Here's the code I have, but it's not working.
Dim Part
[partnumber].setfocus
Part = InputBox("Enter the part number.")
DoCmd.FindRecord "=part"

When I enter the part number in the inputbox I get an error message that says "An expression you entered is the wrong data type for one of the arguments."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top