Value of List Box reflected in master table

sclark

Yamo be there
Local time
Today, 14:54
Joined
Mar 1, 2007
Messages
60
I have form, frmCallInfo, in which there are several list boxes that are autopopulated with just one value based on the query of a combo box; cboEmployeeName. I chose to use a list box (rather than a text box) because it has the Control Source, Row Source type and Row Source that I needed for each of the list boxes to run the query. The list boxes are txtSupervisor, txtBusinessArea, and txtJobType (each have their own associated table of values to autopopulate from).

When an employee name is selected in cboEmployeeName, the other three list boxes are autopopulated. Ex: Choosing "Joe Blow" from cboEmployeeName populates txtSupervisor with "Lopez", txtBusinessArea with ""Clinical Care", and txtJobType with "Technician". This works fine except that the values that autopopulate to the list boxes are not stored in the master table tblCallInfo.

How do I store this info from each record of the form in the master table? I am sure it requires some code (but I am not saavy enough to be able to write it yet).
 
First the form has to be bound to a your table (or a query that includes the table); in the form'sProperty Box the Record Source should show the table/query the form's bound to.Then the controls txtSupervisor, txtBusinessArea and txtJobType have to be bound to the table/query.

Right click on a control (textbox) click on Properties
Click on the Data tab
Goto Control Source and select the field you want that control stored in

Repeat this for each control

Good Luck!
 
Actually, each txt box is bound to the master table field via the Control Source. Ex: list box txtSupervisor is bound to the master table tblCallInfo via field SupervisorID.

That doesn't seem to be the culprit.
 
As a follow-on, when I "change format" the list box to a combo box (which I do not want to have to do because of the asthetics and extra step to select) it works fine (recording the value to the master table).

Also, when I click on the value of each text box after it populates, (essentially, this is selecting the value) it records the value in the master table also. Looks like I have to have some kind of code that selects the value afterupdate of the list box.
 
In order to bind a list box to a field, it's Multi-select property can't be set to yes.
 
The Multi-select property shows "None" from a a possilbe selection of "None", "Simple", and "Extended".
 
So, it should be able to be bound to a field in the table. Make sure the correct column is set as the bound column. With the bound column property it is 1 for the first column, 2 for the second, etc., unlike the coding where the first column is referred to as 0, second column 1, etc. Also, make sure the correct number of columns are listed in the number of columns property when the bound column is something other than 1.
 
I set the query up to return 2 columns. Ex: for Supervisor, the query returns "4" and "Lopez". I have the Column count set to "2" and the width 0";1". I have the bound column set to "1" and the field in the master table is SupervisorID which is numeric.

Seems like I have all the settings as you indicated.
 
After fooling around with this a bit. I believe the key must be in some type of afterupdate code. As I mentioned, if I click on the value that was autopopulated in the list box, the value is "posted" correctly to the master table; but not unless I click on it.
 

Users who are viewing this thread

Back
Top Bottom