G
Guest
I have a main form- frmFTE and subform- frmTaskFee that are linked. I have a
combo box on the main form- cboJobTitle -that finds related records in the
subform upon selecting a value. If an end-user needs to add values to
cboJobTitle, they click a command button that opens another data entry form
to the related record. The record source for cboJobTitle and the related form
are the same so adding data to the form updates the combo box. After adding
values to the related form, and closing it, the user returns back to frmFTE1.
I have cboJobTitle set to requery on GetFocus so that it reflects updates to
the underlying row source. This seems to be working, as the list is updating
properly. However, the first time I select a newly added value to the combo
box, my subform doesn't refresh. It refreshes for preexisting values but not
for new ones. I have to click it twice for it to work. Any thoughts? I'm
new to VBA so any help is appreciated. My code below if for cboJobTitle:
Private Sub cboJobTitle_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FTEID] = " & Str(Nz(Me![cboJobTitle], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Forms!frmFeeTitles1.Recalc
End Sub
Private Sub cboJobTitle_GotFocus()
Me.Recalc
End Sub
combo box on the main form- cboJobTitle -that finds related records in the
subform upon selecting a value. If an end-user needs to add values to
cboJobTitle, they click a command button that opens another data entry form
to the related record. The record source for cboJobTitle and the related form
are the same so adding data to the form updates the combo box. After adding
values to the related form, and closing it, the user returns back to frmFTE1.
I have cboJobTitle set to requery on GetFocus so that it reflects updates to
the underlying row source. This seems to be working, as the list is updating
properly. However, the first time I select a newly added value to the combo
box, my subform doesn't refresh. It refreshes for preexisting values but not
for new ones. I have to click it twice for it to work. Any thoughts? I'm
new to VBA so any help is appreciated. My code below if for cboJobTitle:
Private Sub cboJobTitle_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FTEID] = " & Str(Nz(Me![cboJobTitle], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Forms!frmFeeTitles1.Recalc
End Sub
Private Sub cboJobTitle_GotFocus()
Me.Recalc
End Sub