Auto Filling in data on a form

  • Thread starter Thread starter Katrobinson
  • Start date Start date
K

Katrobinson

Guest
On my form I have Name, E-mail Address, Phone, Fax.
I have a table that contains all that data.
I have the Name field as a combo box.
How do I have it so that when a name is selected all the other fields automatically fill in?
 
I cannot seem to get it to work.
I get an error "Run Time Error 2465 - Can not find the Field "Action Assigned..""

Here's the code I put in:
Private Sub ActionAssignedTo1_AfterUpdate()

Me.[Actionee Code] = Me.[Action Assigned].Column(1)
Me.[Actionee Phone] = Me.[Action Assigned].Column(2)
End Sub


I have my main table with all the data and another table called Actionees that has the fields named: Action Assigned, Actionee Code, Actionee Phone.

I want to be able to, in the form view, using the combo box (may-be I created that wrong?) pick the actionee and have the other field on the form filed in.

Am I making sense?
 
Well, I guess, first of all, make sure you are calling your fields correctly. I see that you have "actionassignedto1" in the Private Sub line, and "me.[action assigned]" in the code. Make sure your field name (and not just the control source) matches what you call in the code.

Secondly, I feel it's better to have the control source of the combo box be a query (even if it exactly matches the table format) because then you can make changes to the table design, etc. and it won't affect your combo box.

Next, you probably have to make sure and have the field you want to use as the combo box (ActionAssigned) in the table that the main form uses. Otherwise you'll need to query the two to get them all in one place (unless your combo box is on a subform).

The one thing that confuses me here is that you say you want to pick the actionee and have the other info filled in. Is the actionee part of the combo box (ie. the same as Action Assigned)? or is Action Assigned another piece of data you want to be filled in?

Lastly, maybe you don't have your combo box setup right. It should have all the columns from your query that you want to be filled in (phone, etc.). You have to "hide" them by setting the number of columns in the combo box properties to match the number of columns inthe query, then set the columns you don't want visible in the actual combo box field to width=0"

Lets see how those suggestions help you out, if they do...
 

Users who are viewing this thread

Back
Top Bottom