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

im confused with access

Status
Not open for further replies.

paul123456

Technical User
Apr 29, 2002
518
US
heres what i got

tables

client claim

socsecid(pk)--- claimnum
firstnm l---socsecid
md claimamt
lastnm reportedby
suffix initialcontactdate
address1 verifieddate
address2
city
state
zip
phone

tables client and claim have connected by socsecid

i created a form called master with all of the client table and a sub form with all of the claim table.

now what i want to do is at the top of the master form have a field were i can enter the soc and the record of that person pulls up also i would like to have a button that clears all info on the screen and allows for a new entry to be put in. i think that anyone that could help me on this issue deserves a big fat star. Thanks, PAUL

 
Hi Paul,

If your fields are all bound, all you have to do is set the Recordsource for the form to a query similar to the one below:

SELECT Client.*
FROM Client
WHERE ((([Client].[socsecid])=[Forms]![Master]![txtSSN].[value]));

txtSSN is the name of your text box.

You would put this code in the AfterUpdate event of the text box. As soon as you change the recordsource, Access automatically requeries all the objects on your form and populates the fields. If you set the subform up as a child and relate the tables properly, those fields should populate as well.

I'd highly suggest that you use a combo box or list box instead of a text box because it is much easier for the user to find what they are looking for. You'd use the same code as above. The only difference would be that txtSSN would change to the name of the control where the user types or selects what they are looking for. Another advantage to using a list box or combo box is the click event triggers the procedure where you change the recordsource. If you use a text box, you'd have to either use the OnChange event which runs everytime they press a key, or they would have to tab out of the field to run the event. That's not a real good solution. If you are using unbound fields, it's a little trickier to do what you want, but it still isn't very hard. Post back if you are using unbound fields and I'll see if I can help further.

dz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top