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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lookup data from a Form

Status
Not open for further replies.

AndyMarshall

Technical User
Oct 3, 2002
8
Hi

I am a newbie to access, what I am trying to do is quite simple in practice but I am having problems in Access.

What I want is to enter a longer number into a text box or simular in a form, once the number matches that stored in the database then to display the rest of the information contained in the fields i.e.

Code
Name
Address
Picture

so when a code is entered and matched what is stored in a table to display the name address and a bitmap image. If anybody could show me a simple way that this can be acheived.

Thanks.
Andy Marshall.
 
This depends if you want to show an exact match or whether you only want to search for anything that partially resembles what you enter as search criteria.

If you only want to look for an exact match then do this:

I'll presume you already have the form made up bound with the data you want to search within (lets assume you called it 'frmMydata').

1. Make a New form (call it 'frmSearch') and add an unbound textbox to it, call it
Code:
 (or whatever)
2. Then Add a subform, and choose 'frmMydata' as your sub
3.If the field [code] exists both on frmMydata and frmSearch then simply choose the predefined link criteria.  Oterhwise at this stage press cancel.
3a. If you cancelled, then go to the properties of the subform and add "[code]" (no quotes) to "Link Child Fields" and "Link Master Fields".

i.e.

Link Child Fields..........[code]
Link Master Fields.........[code]

4. Run the form and type a value to frmSearch.[code]

You will ONLY get a result once a valid code has been entered.

Let me know how you get on.
[yinyang]
 
Thanks for the help, I have managed to get it working.

One last question, if the data is not in the database then how do I get the message "data not in the databae or simular" or create a new record?

ps.

When I first started to get it working a blank screnn appeared with enter string, once a regognized number was entered all the deatils where displayed in a separate page, which is exactly what I want. I then put in a command box to open the FrmSearch after the details have been seen to go back to the blank screen with the "Enter String" command, since I have done this the blank screen with enter string has disappeared for good and both form and the subform are displayed and it still works but I thought it was good with the Enter String screen. Have I done something wrong?

Thanks
Andy Marshall
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top