C
Catherine M
I have two forms " frmClientList" and "frmClientEntry"
based on one table "tblClientList".
"frmClientEntry" is a popup nonmodal form opened from
form "frmClientList". It is not a subform.
The form "frmClientList" displays all records but does not
allow edits, deletions or additions. All changes/additions
are done on form "frmClientEntry". No deletions are
allowed.
I want to requery form "frmClientList" whenever a record
is saved on frmClientEntry, and move to the record just
saved. This works fine when editing an existing record
but not when a record is added. I believe this is because
the recordset for form "frmClientList" does not include
the new record. How do I get the requery to include a
record added on form "frmClientEntry"?
On form "frmClientEntry" I use the following code to save
the record and then requery the underlying
form "frmClientList":
DoCmd.Save
gstrHoldRecNum = Me.txtRecNum 'global variable
used to move to this record on form "frmClient List" after
the requery
Forms!frmClientList.SetFocus 'Sets focus to
form "frmClientList" so requery can be done
Call Forms.frmClientList.subRequery_ClientList '
calls the requery subroutine
Forms!frmClientEntry.SetFocus ' Sets focus back
to form "frmClientEntry"
In subRequery_ClientList on from "frmClinetList" I have:
' Any filter is removed to be sure added/edited data
will be displayed.
Me.FilterOn = False
Me.Filter = ""
DoCmd.Requery "" ' Requery the form
Me.Recordset.MoveLast ' Make sure all record are
available
Me.RecNum.SetFocus ' set focus to field you are
looking for value of
If Nz(gstrHoldRecNum) <> "" Then ' Make sure
variable has a value
If gstrCurrentRecNum <> gstrHoldRecNum Then
DoCmd.FindRecord gstrHoldRecNum, , ,
acSearchAll, , acCurrent ' goes to record just added or
edited
End If
End If
Does anyone have a solution?
Catherine
based on one table "tblClientList".
"frmClientEntry" is a popup nonmodal form opened from
form "frmClientList". It is not a subform.
The form "frmClientList" displays all records but does not
allow edits, deletions or additions. All changes/additions
are done on form "frmClientEntry". No deletions are
allowed.
I want to requery form "frmClientList" whenever a record
is saved on frmClientEntry, and move to the record just
saved. This works fine when editing an existing record
but not when a record is added. I believe this is because
the recordset for form "frmClientList" does not include
the new record. How do I get the requery to include a
record added on form "frmClientEntry"?
On form "frmClientEntry" I use the following code to save
the record and then requery the underlying
form "frmClientList":
DoCmd.Save
gstrHoldRecNum = Me.txtRecNum 'global variable
used to move to this record on form "frmClient List" after
the requery
Forms!frmClientList.SetFocus 'Sets focus to
form "frmClientList" so requery can be done
Call Forms.frmClientList.subRequery_ClientList '
calls the requery subroutine
Forms!frmClientEntry.SetFocus ' Sets focus back
to form "frmClientEntry"
In subRequery_ClientList on from "frmClinetList" I have:
' Any filter is removed to be sure added/edited data
will be displayed.
Me.FilterOn = False
Me.Filter = ""
DoCmd.Requery "" ' Requery the form
Me.Recordset.MoveLast ' Make sure all record are
available
Me.RecNum.SetFocus ' set focus to field you are
looking for value of
If Nz(gstrHoldRecNum) <> "" Then ' Make sure
variable has a value
If gstrCurrentRecNum <> gstrHoldRecNum Then
DoCmd.FindRecord gstrHoldRecNum, , ,
acSearchAll, , acCurrent ' goes to record just added or
edited
End If
End If
Does anyone have a solution?
Catherine