Re: Requery/bookmark

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




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]

.



Relevant Pages

  • Re: Requery/bookmark
    ... "Marshall Barton" wrote: ... Recall that user is on Receipts form, opens Invoice form, updates, then ... I want to return to the Receipts record user was on when Invoice form was ...
    (microsoft.public.access.formscoding)
  • Re: Requery/bookmark
    ... Maybe the record you were on in the Receipts form is not ... identified by the InvNum field?? ... Recall that user is on Receipts form, opens Invoice form, updates, then ... I want to return to the Receipts record user was on when Invoice form was ...
    (microsoft.public.access.formscoding)
  • Open form in dialog mode
    ... I have an invoice form that has a button on it for adding a new sales item ... The problem is that when I open the new form in dialog mode the window opens ...
    (microsoft.public.access.formscoding)
  • Re: How do I link a form with another form?
    ... I've created a marco that opens the "Invoice form" with the "where ... "Al Camp" wrote: ... > Use the Click event of your Form1 button, ...
    (microsoft.public.access.forms)
  • Requery/bookmark
    ... I open Invoice form from a Receipts form, ... OnClose Invoice form I return to the Receipts form record, ...
    (microsoft.public.access.formscoding)