aziz rasul
Active member
- Local time
- Today, 01:54
- Joined
- Jun 26, 2000
- Messages
- 1,935
I have 2 labels and a combo box i.e. Label1, Label2 and cboSurgeons
When double clicking Label1, you can edit-delete-add records in tblSurgeons. On closing the table, cboSurgeons is updated. Here's the code. cboSurgeons is bound on an ID values, e.g. 1, 2, 3, etc.
Label2's caption property takes the firstname and surname from the update
event of cboSurgeons i.e.
Here's the problem. When I double click Label1 and edit a record, how can I update the caption on Label2 assuming the firstname or surname has changed for the ID value in cboSurgeons?
When double clicking Label1, you can edit-delete-add records in tblSurgeons. On closing the table, cboSurgeons is updated. Here's the code. cboSurgeons is bound on an ID values, e.g. 1, 2, 3, etc.
Code:
Private Sub Label1_DblClick(Cancel As Integer)
DoCmd.OpenTable "tblSurgeons", acViewNormal, acEdit
Me.cboSurgeons.SetFocus
Me.cboSurgeons.Requery
Me.Refresh
End Sub
Label2's caption property takes the firstname and surname from the update
event of cboSurgeons i.e.
Code:
Private Sub cboSurgeons_AfterUpdate()
If IsNull(Me.cboSurgeons) = False Then
Me.Label2.Caption = DLookup("Firstname", "tblSurgeons", "[SurgeonID] =" & Me.cboSurgeons) & " " & DLookup("Surname", "tblSurgeons", "[SurgeonID] =" & Me.cboSurgeons)
Me.Label2.ForeColor = 0
Else
Me.Label2.ForeColor = -2147483633
End If
End Sub
Here's the problem. When I double click Label1 and edit a record, how can I update the caption on Label2 assuming the firstname or surname has changed for the ID value in cboSurgeons?