From Controls

  • Thread starter Thread starter TaylorLeigh
  • Start date Start date
T

TaylorLeigh

I have a form with a control to add a new product when the product is not on
my list. This control works as it should with one exception. I want the
product list updated when I return to the form. As it stands now, I have to
close the data entry form and reopen before the new product will appear.

Thanks,
 
Not really. All you need to do is requery your form. There is one catch.
That is when you requery a form, it will go back to the first record in the
form's recordset as the current record. If you want to make the new
product the current record, you have to capture the primary key value of the
new record before the requery. Then after the requery you can use the
FindFirst method to move to the newly added record. Since you don't say how
you are adding the new record, I will use a generic example assuming you are
using the Not In List event of a combo box:

Me.Requery
With Me.RecordsetClone
.FindFirst "[PrimeKeyField] = " & NewData
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
 
Back
Top