I have a form "AddClass" that pops up to add a "Class" number to the Main form that is behind it. THe Class number is in a ComboBox.
When adding the Class I want it to automatically update the Class Combobox with the most recent number and have it selected.
The class number updates with the code below but there are 2 fields next to it for date and time, that still show the previously selected date and time
Code:
Private Sub Form_Close()
If Forms!frmMainForm!cmbChooseClass >= 0 Then
With Forms!frmMainForm!cmbChooseClass
.Value = .ItemData(.ListCount - 1)
End With
Else
End If
End Sub
On the Main form if I choose the Class number by clicking it in the Combo Drop down it does update the date and time.
Below is the code that makes that work.
I am trying to adapt the code to work in
Code:
Private Sub cmbChooseClass_AfterUpdate()
txtDateOpened = DLookup("[Date Opened]", "qryClientClass", "[qryClientClass].[ClassNumber]=" & [cmbChooseClass])
txtStarted = DLookup("[Time Opened]", "qryClientClass", "[qryClientClass].[ClassNumber]=" & [cmbChooseClass])
txtClassRecordNumber = DLookup("[RecordID]", "qryClientClass", "[qryClientClass].[ClassNumber]=" & [cmbChooseClass])
Me![tblProbes subform].Form.Requery
End Sub
Any help would be appreciated!