Find Record Combo Box Not Working on First Click

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
If I understand what you are doing, you are creating a new record each time
you open the edit/entry form. So if you expect to see the new record on the
current form, you will need to requery the form vs. (refresh and filter).

If all the data is the same on the two forms, why not do your edits and
entry all on the same form? If some of the data elements of your current
record need to be placed in a new record, you can save those elements to some
variables, then once you are on the new record, populate the form from the
stored variables.

In any case, it sounds as though you are doing more work than necessary.

Hope this helps.

Best

J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top