Re: Requery/bookmark
- From: Skunk <webmaster@xxxxxxxxxxxxxxx>
- Date: Wed, 24 Sep 2008 10:46:01 -0700
Thanks for responding, Marshall.
I didnt' think that would help (it didn't) as I am returning to prior form
still open.
Recall that user is on Receipts form, opens Invoice form, updates, then
closes Invoice, returning - after requery - to the Receipts form. The first
record is visible now that is has been requeried, not the record I left.
I want to return to the Receipts record user was on when Invoice form was
open. The code is in my OnClose event for the Invoice form.
This code surely works, I have it several places, but I am on only one form
then. This is two forms.
Can you help me?
"Marshall Barton" wrote:
Skunk wrote:.
I open Invoice form from a Receipts form, updating Invoice form. Both are
open.
OnClose Invoice form I return to the Receipts form record, after Receipts
form requery.
My code is:
Forms![2frmPRReceipts].Requery
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "forms![2frmPRReceipts].form![txtInvNum] = " & Me![txtInvNum]
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
It's better to use RecordsetClone instead of
Recordset.Clone, even if they are logically the equivalent.
The former is a built in recordset, while the latter must be
constructed each time it is used.
Assuming the txtInvNum text box control is bound to the
InvNum field, try using:
Set rs = Me.RecordsetClone
rs.FindFirst "InvNum = " & Me![txtInvNum]
The reason being that FindFirst searches the record source
records for a matching value in a **field**. It is not
aware of the controls in the form.
--
Marsh
MVP [MS Access]
- Follow-Ups:
- Re: Requery/bookmark
- From: Marshall Barton
- Re: Requery/bookmark
- References:
- Requery/bookmark
- From: Skunk
- Re: Requery/bookmark
- From: Marshall Barton
- Requery/bookmark
- Prev by Date: How to refresh a form
- Next by Date: Launching another MS Access application within code
- Previous by thread: Re: Requery/bookmark
- Next by thread: Re: Requery/bookmark
- Index(es):
Relevant Pages
|