By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,475 Members | 2,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,475 IT Pros & Developers. It's quick & easy.

Auto Fill Field

P: 2
I would like to be able to auto fill field B with contents of Field a when Field A is a specific word, e.g DNA in Field A would apply to Fields B, C, D etc. Any ideas?
Feb 7 '08 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,186
You don't say when Field A is populated.
If it's updated on a form then the AfterUpdate event would be where you'd put the code. In fact you don't really say much. If you can make the question a little better specified we'll see what we can do to help.
Feb 7 '08 #2

P: 1
I too have an auto fill question designed in Access.

I'm in my Form, I have a field named RELEASE TO (a combo box) and another field named: LOCATION.
I want my Release To selection auto populate the Location field. This is what I want to end up with.

RELEASE TO: JOE BLOW
LOCATION: SANTA LUISA

Do I create a Macro and if so does anyone know how?
or
Do I create a Expression?

This is relatively simple but not for me....
Goozerlinda
Feb 8 '08 #3

P: 11
Subscribed because I would like to know how to do this as well. In my particular case, I would like to have the fields automatically update based on either a primary key, or my selection of a last name.

For instance: I have a table titled "tblPersonnel" which contains very basic info [SSN], [lastname], [firstname], [mi]. I have another tabled titled "tblRecall" which contains [SSN],[Address],[City],[State],[Zip]. I want to create a form titled "frmRecall" which is where I will add and edit a person's contact information after I create him/her in the Personnel table. (So in essence, once I hit close on the "add new person" form, the contact info form will pop up). I want the form to automatically put a person's firstname, lastname, mi in the appropriate fields when I select any of the following criteria: SSN or Lastname. I think this is pretty much the same question as the previous two, but just to let everyone know that there is a demand for the answer. :)
Feb 8 '08 #4

NeoPa
Expert Mod 15k+
P: 31,186
People,

This is not how things should be done as this (multiple questions in one thread) is very confusing and takes the thread away from the OP (original poster).

Check the Help link at the top for a comprehensive list of dos and don'ts.

To express interest in an answer is fine, but this does not involve sharing your own details. If it's different enough to need extra explanation of your situation, then it needs its own thread.

This one's not likely to be much use anyway as the OP hasn't even replied. If they do it'll progress, but if not ...
Feb 9 '08 #5

P: 11
Ok, I figured out how to do this in case anyway is still interested.

Let's assume that the name of the combo box that you wish to select your customer is called cboList and the name of the fields you wish to have automatically update are Lastname, Firstname,CustomerID. Let's also assume that the table you are drawing information from is named tblCustomers.

First of all, select your combo box in design view and right click to view properties. Under the Data tab in the properties window and in the Row Source line you should insert the following information:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblCustomers.Lastname, tblCustomers.Firstname, tblCustomers.CustomerID FROM tblCustomers ORDER BY tblCustomers.Lastname;
Now under the Format tab of the properties window, find Column count and make sure the number indicates the amount of columns you want displayed. In our case, we are asking for three sources of information, so we will put 3 in the field. We only want to see the last name in our pull down menu, so we will set the column width to 0"; for those columns we don't wish to be displayed. In this instance, we are going to assume that we want to only see the customer's last name and first name, so we will set the column width to 1";1";0";. Now when you switch to form view, you should be able to hit the pull down button and see all of your customer's names. However, we still need to create an After Update event to populate the information we want to see. This should look like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboList_AfterUpdate()
  2. On Error Resume Next
  3.  
  4.     cboList.SetFocus
  5.  
  6.     Me.CustomerID = cboList.Column(2)
  7.     Me.Lastname = cboList.Column(0)
  8.     Me.Firstname = cboList.Column(1)
  9.  
  10. End Sub
This should work. If not, let me know and I'll see if I left something out.
Feb 11 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.