View Full Version : Need help with filling a label with table value after combo choice is clicked


CamaroMan
01-29-2008, 12:41 PM
I could use some advice on how to fill a label with a table value from access after the user chooses a value from the combo box also driven by an access table. The dropdown combo box is loading the values from the table, but when you click on a value, the label does not change accordingly. Here is my code for loading the combo meal. :confused:

Private Sub cboJobs_DropDown()

Dim db As Database
Dim rs As Recordset
'Set global database path
Set db = OpenDatabase("C:\Documents and Settings\HP_Owner\My Documents\database\PayRate.mdb")

'Set local rs to get next booking number
Set rs = db.OpenRecordset("PayRate")

rs.MoveFirst

Do Until rs.EOF
cboJobs.AddItem rs.Fields("JobTitle")
rs.MoveNext

Loop

End Sub

'calls on the table in the database
Private Sub datContact_Reposition()
Static pblnFirst As Boolean
If pblnFirst = False Then
Set mrstContact = datContact.Recordset
pblnFirst = True
End If
End Sub

Uncle Gizmo
01-29-2008, 12:46 PM
Well if it was a "normal combo box" based on a query or table, then you would use the after update event of the combo box with something like the following code :

Me.Label.Caption = Me.ComboBox