afterupdate - please help

EmperorSpry

New member
Local time
Yesterday, 19:39
Joined
Jun 19, 2007
Messages
5
I have combo box that lists different stations that fall under my office. The info pulls from a database that has all the stations, their phone and fax numbers.

On the form, I have a text box for the phone and the fax but I want it to automatically update when I select a recruiting station in the combo box.

To get it to work right I know you have to go into visual basic to tweak it but the code that i've been entering in only produces errors.


Database - Stations
combo box name - WI-Station
phone text box - WI-Station Phone
Fax text box - WI-Station Fax
 
what is the code for your combo box? Does it have multiple columns?
 
ComboBoxes have a Column property starting with 0 for the 1st column. If the data you need is available in the ComboBox, visible or not, then:
Me.[WI-Station Phone] = Me.WI-Station.Column(1) will work for the 2nd column in the cbo.
Here's some links to review in your spare time:
List of reserved words in Access 2002 and Access 2003
List of Microsoft Jet 4.0 reserved words
Special characters that you must avoid when you work with Access databases
 
Private Sub Station_List_AfterUpdate()
Me.[WI-Station Phone] = Me.Station_List.Column(2)
Me.[WI-Station Fax] = Me.Station_List.Column(3)
End Sub

This is what I have and it still doesn't pull the information.

And it doesn't pull any information after that.
 
Are you pulling the data for the other columns? What is the SQL for the RowSource of the ComboBox.
 
This is what I have right now in VB
Private Sub Station_List_AfterUpdate()
Me.[WI-Zone] = Me.Station_List.Column(1)
Me.[WI-Station Phone] = Me.Station_List.Column(2)
Me.[WI-Station Fax] = Me.Station_List.Column(3)
End Sub

This is whats listed on the rowsource of the combo box
SELECT Stations.Stations, Stations.Zone, Stations.Phone, Stations.Fax FROM Stations ORDER BY Stations.Stations;

The combo box only has 1 column but all the columns from the table are selected. The "Zone" textbox actually updates with the correct information but the phone and fax remains blank even though the info is in the database.
 
The combo box only has 1 column but all the columns from the table are selected. The "Zone" textbox actually updates with the correct information but the phone and fax remains blank even though the info is in the database.
Did you make sure to change the combo property Column Count to 4 and make sure that all fields are checked (selected) and then the Widths are set to something like 1";0";0";0" so that only the first column shows but the others are available?
 

Users who are viewing this thread

Back
Top Bottom