Report problem caused by form

  • Thread starter Thread starter Derek
  • Start date Start date
D

Derek

Hi all

I have a main form with subform. The main is customer
contact details with a subform which holds all
correspondence to the customer. I have a pop up form that
I use to sellect standard letters to append to the
customer subform table. This duely places the standard
letter into the customers subform and my code moves the
subform to the new appended letter. If I then click on a
button in the subform to print the letter I get an error
presumably because the subform has not refreshed or
requeried the underlying dater and dispite the fact that
it is clearly there it will not print until I have
manually refreshed the records. If the cursor when I
refresh is in the subform even that does not work. I have
tried:

Dim BM as variant
BM = Me.BookMark
Me.Requery
Bookmark = BM

To no avail. I must admit I am always fighting with access
when it comes to showing right up to the second
information. What am I missing?

Thanks.
 
After a Requery the form has a "different" recordset. The bookmarks are no
longer reliable. If you want to return to the same record you were at before
the requery, store the value of a unique field for the record, such as the
primary key field, and then move to that record after the requery.

lngPreviousLocation = Me.txtKeyField
Me.Requery
Me.Recordset.FindFirst "KeyField=" & lngPreviousLocation

This is assuming a Long Integer value, such as with an Autonumber field. If
the field is a text value, add quotes as needed.
 
Hi

Thank you I will try that..

-----Original Message-----
After a Requery the form has a "different" recordset. The bookmarks are no
longer reliable. If you want to return to the same record you were at before
the requery, store the value of a unique field for the record, such as the
primary key field, and then move to that record after the requery.

lngPreviousLocation = Me.txtKeyField
Me.Requery
Me.Recordset.FindFirst "KeyField=" & lngPreviousLocation

This is assuming a Long Integer value, such as with an Autonumber field. If
the field is a text value, add quotes as needed.

--
Wayne Morgan
MS Access MVP





.
 
Back
Top