Autofill text box based on Combobox selection (1 Viewer)

alabk

New member
Local time
Yesterday, 19:47
Joined
Dec 11, 2012
Messages
5
Hello!

I have read and reread similar threads about autofilling fields based on a combobox but I just can't get it to work. I am new to Access, but have created a database and so far have gotten by with just using macros. I am trying to speed up the data entry and have just starting getting into coding, but I can't get any of my codes to work!

Here's my problem:

I have a form called "Implementations." It is based on table "Client Site Information." I have created a combobox in the form called CboAnalystAssigned and at the last minute I decided I want the selection of that combobox to populate a new field on the form called Txtanalystphone. I also would like the selection in the combobox of "Analyst Assigned" and the autofilled "Analyst PHone Number" to be filled into their corresponding columns in the table "Client Site Information."

So far what I have done is create a separate table called "AnalystphoneNumbers" listing the "AnalystAssigned" names and the "Analyst Phone numbers." AnalystAssigned is the primary key. I have linked the AnalystPhoneNumbers table to the Client Site information table by the AnalystAssigned field.

Then I set up the Combobox (CboAnalystAssigned) with two columns, the first is AnalystAssigned and second is AnalystPhone. The Combo box has a Row Source of SELECT AnalystAssigned, AnalystPhone, FROM AnalystPhoneNumbers ORDER BY AnalystAssigned.
And in the After Update Event of the combobox I have entered:

Private Sub CboAnalystAssigned_AfterUpdate()
Me.Txtanalystphone = Me.CboAnalystAssigned.Column(1)
End Sub

THis is the code I am constantly finding as the code to use for this issue but it does not work, nothing is populating in the Txtanalystphone field. What am I doing wrong? I appreciate any help you can give me.
 

mahenkj2

Registered User.
Local time
Today, 06:17
Joined
Apr 20, 2012
Messages
459
Code is simple and as such it should work fine. There is something silly going on. Just post your form with table if you do not find.
 

mahenkj2

Registered User.
Local time
Today, 06:17
Joined
Apr 20, 2012
Messages
459
Have you checked that your combo is populating two columns data?
 

alabk

New member
Local time
Yesterday, 19:47
Joined
Dec 11, 2012
Messages
5
Thanks for the response mahenkj2!

The Combobox Column Count is at 2 so it should be populating two columns. I just have the Width set at 1", 0" so that the second column is hidden.

I have attached a barebones version of my database. Please let me know if you find anything.

Thanks again!
 

Attachments

  • Portal Implementation Database2.accdb
    1.8 MB · Views: 499

mahenkj2

Registered User.
Local time
Today, 06:17
Joined
Apr 20, 2012
Messages
459
It is working on my PC. Are you enabling the security alarm when first the database is opened. Options and Enable this content.

Anyway, in the combo, you have selected the analystassigned twice. Although it does not have any link to your current problem but then your first column is naming to Expr1 by access so better remove the third column.

revert back if still problems.

best regards.
 

alabk

New member
Local time
Yesterday, 19:47
Joined
Dec 11, 2012
Messages
5
My Bad. Works perfectly now. :)

Thank you!
 

Users who are viewing this thread

Top Bottom