MS Access Forum / Forms / May 2007
AutoFill fields in Access forms
|
|
Thread rating:  |
ISU_Scheman_Tech_kid - 30 May 2007 19:23 GMT First off I want to say thank you to Microsoft, secondly I want to say that I have very little experience with access, now onto the problem. I need to make a form for my access database and in that form there must be a couple of fields (Client phone,Client E-mail, Client Location) that automatically fill upon the completion of a clients name in another field. This Should work like most forms that I have seen where you enter the name and the form enters the data associated with that client in previous records. I hope to hear back soon and yet again thank you for your help.
Klatuu - 30 May 2007 20:46 GMT See my reply to "Automatically fill a group of text boxes ba..." posted by Sara today. It is the same question.
 Signature Dave Hargis, Microsoft Access MVP
> First off I want to say thank you to Microsoft, secondly I want to say that I > have very little experience with access, now onto the problem. I need to [quoted text clipped - 4 lines] > the data associated with that client in previous records. I hope to hear > back soon and yet again thank you for your help. ISU_Scheman_Tech_kid - 30 May 2007 21:18 GMT I read the post that you answered but that isn't the case here, with all due respect. I need to add in customers, and be able to reference their data whenever they revisit the form. The cliet name is in a feild with the type text. I thought I would try to compare the name to all perivious names in either the main record or a query of the record, but I come across problems. For one, the search fills in all fields of my form with the first occurace of the customer rather than just filling in the customer's phone number, e-mail, and address fields. I guess I did a poor job to define what was my problem at first, hopefuly this will make things more clear. Thank you.
Klatuu - 30 May 2007 22:01 GMT Sorry, but it is no clearer. Can you give it one more go?
 Signature Dave Hargis, Microsoft Access MVP
> I read the post that you answered but that isn't the case here, with all due > respect. I need to add in customers, and be able to reference their data [quoted text clipped - 5 lines] > and address fields. I guess I did a poor job to define what was my problem > at first, hopefuly this will make things more clear. Thank you. ISU_Scheman_Tech_kid - 30 May 2007 22:31 GMT Okay, here I go . . .
There is a form for a database that enters requests to the database. On that form are four fields: Name, e-mail, phone, address. What needs to be done is when a user enters a name into the field "name" the form searches to database for that name. If the name is one that was used before (it is in the database), then the fields e-mail, phone, and address should be filled with the data that the database holds for those same fields in the record that has the same name as the name entered on the form. If the name entered is not the same as any in the database then the form should leave the fields blank and allow the user to enter new client data (name, address, phone, and e-mail). This new data entered should then be accessible if the same user comes back and enters their name; the fields of address, e-mail, and phone should fill in automaticly (after the name is entered) with the same data as the user ented the last time for that same "name".
I hope this helps you diagnose my problem and yet again I thank you for your time and effort.
Klatuu - 30 May 2007 23:11 GMT well defined, thanks. It is simpler than I originally thought. Actually, the other post I pointed you to is similar, but in your case, you are not looking to another table.
I don't know what your experience level is, so I will try to give the simplest approach. Create a form using the form wizard. When it asks for the query or table, give it the name of your table. Create a lookup combo using the wizard and use the customer Id as the field for the combo. Create text boxes for the other fields. This should do it. If you need more help, post back and we can get it to work. Good Luck.
 Signature Dave Hargis, Microsoft Access MVP
> Okay, here I go . . . > [quoted text clipped - 14 lines] > I hope this helps you diagnose my problem and yet again I thank you for your > time and effort. ISU_Scheman_Tech_kid - 31 May 2007 16:00 GMT I tried what you said and it autofilled every field in the form. I only want the client phone, address, and e-mail to auto fill based on the name, not the entire form. The way that it works now is more like a search form than a request form. What can I do so only certain fields are filled in by the combo box. Thank you very much and remember I am a novice at all this.
John W. Vinson - 31 May 2007 17:10 GMT >I tried what you said and it autofilled every field in the form. I only want >the client phone, address, and e-mail to auto fill based on the name, not the >entire form. The way that it works now is more like a search form than a >request form. What can I do so only certain fields are filled in by the >combo box. Thank you very much and remember I am a novice at all this. Relational databases use the "Grandmother's Pantry Principle": "a place - ONE place! - for everything, everything in its place".
If you are trying to store multiple copies of the client information in your database - either by storing the same information repeatedly in multiple records, or copying it from one table into another - you're missing the point of how relational databases work. The phone, address, and email information should be stored, once and once only, in the Client table; it is neither necessary nor desirable to copy it into any other record or any other table.
You can *display* the information on the form by including the fields in the combo box, and setting the control source of textboxes on the form to
=comboboxname.Column(n)
where n is the zero based index of the field you want to see; that is, if the combo box is named cboClientID and the email addess if the fifth field in its row source query,
=cboClientID.Column(4)
John W. Vinson [MVP]
|
|
|