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!

Access forms that can find records....

Status
Not open for further replies.

outhere

IS-IT--Management
Jul 29, 2001
116
CA
Hi,
Can someone point me in the right way of creating forms within access 97 that would be able, by typing say...the phone number of a particular record, and retreiving the other data for that record in a specified table. Is it a form I'm even looking for?
* Just in case Im being too vague, I'm looking for a way to update client info in a "foolproof" kinda way for my client database.

cheers steve
 
Set up a command button on your form, and add the following code to the On Click event of that button (making sure that you change the field and control names to your actual field/control names):

Private Sub cmdFindName_Click()
'Search for a Specific Surname in the "Surname" field.
On Error GoTo Err_cmdFindName_Click
Dim strLen, i As Integer
Dim strTempName, strSearchName As String

strLen = Len(strSearchName)

DoCmd.GoToControl "YourControlToSearch"
strSearchName = InputBox("Enter the Surname to search for.", "Look Up Surname")
DoCmd.FindRecord strSearchName, acAnywhere, , acSearchAll, , acCurrent, True
DoCmd.RunCommand acCmdFind


Exit_cmdFindName_Click:
Exit Sub

Err_cmdFindName_Click:
Msgbox Err.Description
Resume Exit_cmdFindName_Click

End Sub

What this code does is open the "Find" command (Edit|Find on the Menubar) and allows you to search for whatever you input.

HTH
Lightning
 
Yes it is a form you want but, you will need to do some coding behind the scenes to pull in the record.

There are some further questions to answer...:cool:

First off when you create your form is it a bound (based on a table, usually created with the wizard) form or
an unbound (not based on a table, done manually).

Is the field you looking up your key index field? (Lookups on key fields go faster)

I have created a lookup for a database I wrote based on vehicle ids.

I can give you the code but how you set up the form is very important. The field that you do the lookup on must be an unbound field. if you want the code let me know.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top