How to update field with value from combo box?

  • Thread starter Thread starter tbrogdon
  • Start date Start date
T

tbrogdon

I have frmProductionOperation which is bound to junction table
tblProductionOperation with a combo box cboWorkstation and a text box
txtOperation.

The row source for cboWorkstation is SELECT
tblWorkstation.WorkstationID, tblWorkstation.WorkstationName FROM
tblWorkstation;

tblWorkstation also has tblWorkstation.OperationID which is linked to
tblOperation.OperationID

The row source for txtOperation is SELECT tblOperation.OperationID,
tblOperation.OperationName FROM Operation;

My question is about txtOperation. When the user selects a workstation
from cboWorkstation I want txtOperation to automatically and
immediately update and be non-editable.

Thank you for your time,

Tim
 
I realized I may have not been explicit enough about something. Every
workstation can have one and only operation type ever.

So when a user selects a workstation the operation type is already
defined. I just want it reflected on my form.

For instance, selecting workstation "H003" should should return
"Press" from tblOperation via the link between
tblWorstation.OperationID and tblOperation.OperationID which is the pk
corresponding to tblOperation.OperationName..

Hoep this helps clarify my question.

Thanks,

Tim
 
I have frmProductionOperation which is bound to junction table
tblProductionOperation with a combo box cboWorkstation and a text box
txtOperation.

The row source for cboWorkstation is SELECT
tblWorkstation.WorkstationID, tblWorkstation.WorkstationName FROM
tblWorkstation;

tblWorkstation also has tblWorkstation.OperationID which is linked to
tblOperation.OperationID

The row source for txtOperation is SELECT tblOperation.OperationID,
tblOperation.OperationName FROM Operation;

My question is about txtOperation. When the user selects a workstation
from cboWorkstation I want txtOperation to automatically and
immediately update and be non-editable.

You can just use a text box for the OperationName. Change
the workstation combo box's row source to:

SELECT tblWorkstation.WorkstationID,
tblWorkstation.WorkstationName,
tblOperation.OperationName
FROM tblWorkstation INNER JOIN tblOperation
ON tblWorkstation.OperationID = tblOperation.OperationID

Set the workstation combo box's ColumnCount to 3 and
ColumnWidths to 0;;0

Then set a text box's control source to:
=cboWorkstation.Column(2)

If you have some other reason for using a combo box for the
operation, then set cboWorkstation's row source to:

SELECT tblWorkstation.WorkstationID,
tblWorkstation.WorkstationName,
tblWorkstation.OperationID
FROM tblWorkstation

ColumnCount 3 and ColumnWidths 0;;0

Use it's AfterUpdate event to set the value of cboOperation:

Me.cboOperation = Me.cboWorkstation.Column(2)
 
Marshall,

Thanks a bunch! I just learned a great, great deal from your response.

You turned the light on for me - thank you. (not that I won't have
more question soon :-)

Tim
 
Back
Top