Form Display

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has several combo boxes that are based off of Queries.
When they make a selection I want the combobox to display the name that is
selected but save the ID number. I know this is easy to do if the combo box
is linked to a table but I don't know how with a query.

Thanks in Advance.

Travis
 
same procedure

Pieter

Tdahlman said:
I have a form that has several combo boxes that are based off of Queries.
When they make a selection I want the combobox to display the name that is
selected but save the ID number. I know this is easy to do if the combo
box
is linked to a table but I don't know how with a query.

Thanks in Advance.

Travis
 
I can make it so that the list in the combo box displays both the ID and the
name, however once I select something it only displays the ID.
 
Which is how Combo's work!

You can however put an unbound Control on the Form
Control: ShowName
Enabled : yes or no
Locked: yes (if Enabled Else no)

And Then in the AfterUpdate Event of the Combo & under Form Current Event
(Event Procedures)

Private Sub cboMyCombo_AfterUpdate()
On Error Resume Next ' Ignore Errors
Me.ShowName.Value = Me.cboMyCombo.Column(1) ' Counts Columns From 0 in
Code
End Sub

Private Sub Form_Current()
On Error Resume Next ' Ignore Errors
cboMyCombo_AfterUpdate()
End If

HTH

Pieter

Normally you'd hide the first (zeroeth) column though by setting the Column
Width property
 
Back
Top