M
Mark Andrews
I have a button on a form that I want to bring up another little form (that
is a simple datasheet) for the user to add new items etc....
My code is:
Private Sub cmdEditEmployees_Click()
DoCmd.OpenForm "frmLookupEmployee",acFormDS , , , , acDialog
Me.ComboEmployee.Requery
End Sub
When the code runs it gets to the second line before the user had time to
add a new item, so after the user adds a new item in frmLookupEmployee and
comes back the ComboEmployee control does not show the
new employee (because the refresh happened before the table was updated).
If I take out the acFormDS the form opens in normal form mode (even though
I only allow datasheet and the default is datasheet), however the running of
the code works differently and the second line runs after the form is
closed, so the refresh works fine.
Private Sub cmdEditEmployees_Click()
DoCmd.OpenForm "frmLookupEmployee", , , , , acDialog
Me.ComboEmployee.Requery
End Sub
What's the best solution? I can refresh in the close event of the datasheet
form (however I call this form from numerous places, so I would rather not
do it that way).
Any help is appreciated,
Mark
is a simple datasheet) for the user to add new items etc....
My code is:
Private Sub cmdEditEmployees_Click()
DoCmd.OpenForm "frmLookupEmployee",acFormDS , , , , acDialog
Me.ComboEmployee.Requery
End Sub
When the code runs it gets to the second line before the user had time to
add a new item, so after the user adds a new item in frmLookupEmployee and
comes back the ComboEmployee control does not show the
new employee (because the refresh happened before the table was updated).
If I take out the acFormDS the form opens in normal form mode (even though
I only allow datasheet and the default is datasheet), however the running of
the code works differently and the second line runs after the form is
closed, so the refresh works fine.
Private Sub cmdEditEmployees_Click()
DoCmd.OpenForm "frmLookupEmployee", , , , , acDialog
Me.ComboEmployee.Requery
End Sub
What's the best solution? I can refresh in the close event of the datasheet
form (however I call this form from numerous places, so I would rather not
do it that way).
Any help is appreciated,
Mark