Combo Boxes

G

Guest

I'm creating a form that will show 3 lists of fault messages. The fault
messages are all stored in the one table and are sorted by a fault type. I
have a Sort Order query for each of the 3 fault lists, which is where the
form gets them from. On the form there is a combo box for each fault type.
Each combo box is bound to the field 'Fault Message' in the table 'Data -
Downtime'. My problem is when I select a fault from one of the lists it is
displayed in all three. How can I set the form so the fault is only
displayed in the combo box it is selected from?

Thanks for the help

Tommy
 
G

Guest

If I understand your roblem correctly, this should work - Don't bind the
three combo boxes to the field in the underlying record set, since they are
all bound to the same item in the record, they all update when you change any
of them. Instead, have an INVISIBLE control, let's say txtSelectedFault,
that is bound to the field in the record that you want to update. It gets
updated when the userexplicitly makes a selection from any of the 3 combo
boxes. Here's a sketch as to how to do it.


Define the 3 combo boxes like this:

cbo_FaultType_1
rowsource = "SELECT [FaultDesc] FROM [tblFaultList] WHERE [FaultType] = 1
ORDER BY [FaultDesc];

cbo_FaultType_2
rowsource = "SELECT [FaultDesc] FROM [tblFaultList] WHERE [FaultType] = 2
ORDER BY [FaultDesc];

cbo_FaultType_3
rowsource = "SELECT [FaultDesc] FROM [tblFaultList] WHERE [FaultType] = 3
ORDER BY [FaultDesc];

but leave them as 'Unbound' controls.

Then set up these events...

Private Sub cbo_FaultType_1_OnClick()
Me.txtSelectedFault = cbo_FaultType_1
End Sub

Private Sub cbo_FaultType_2_OnClick()
Me.txtSelectedFault = cbo_FaultType_2
End Sub

Private Sub cbo_FaultType_3_OnClick()
Me.txtSelectedFault = cbo_FaultType_3
End Sub

----
If you are using ErrorCodes and ErrorDescriptions, you probably would store
the error code in the table. In that case you would do something like this:

combo box row source: SELECT [ErrorCode],[ErrorDescription] FROM ....
combo box number of columns: 2
combo box column width: 0";1.5"
combo box list width: 1.75" ' allow for scroll bar

Then in the OnClick event

txtSelectedErrorCode = cbo_FaultType_1.Column(0)
' Note: 1st column is column(0), 2nd is column(1), ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top