Requery on Continous Sub-Forms

T

TBernard

I have a continous subform, and when I select from a drop
down list I need to requery the subform so that the
information is correctly updated. CODE:

Me.Requery

Everything is working fine, except that when I run this
code it automatically sends the user back to the first
record of the continous form. So if the user is entering
in 20 records, and they select from this drop down list,
the information saves correctly, but they have to scroll
back down the subform to the correct record to continue
entering data.

Does anyone know a work around to this?

Thank you,

TBernard
 
A

Adrian Jansen

Look up the Bookmark example in Help.
Basically you hold a copy of the bookmark ( the current location ) before
the requery, then return to it after requery.


--
Regards,

Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
 
B

Bruce M. Thompson

I have a continous subform, and when I select from a drop
down list I need to requery the subform so that the
information is correctly updated. CODE:

Me.Requery

Everything is working fine, except that when I run this
code it automatically sends the user back to the first
record of the continous form. So if the user is entering
in 20 records, and they select from this drop down list,
the information saves correctly, but they have to scroll
back down the subform to the correct record to continue
entering data.

If you are just trying to cause the record to be saved after making the
selection, don't use the Requery method, set the Dirty property, instead:

If Me.Dirty Then
Me.Dirty = False
End If
 
S

Stephen Lebans

The Bookmark prop is invalidated by calling the Requery method.
A couple of options:
1)
Message 4 in thread
From: Allen Browne ([email protected])
Subject: Re: Problem with Bookmarks in a form


View this article only
Newsgroups: microsoft.public.access.formscoding
Date: 2003-06-26 07:42:42 PST



Assuming you have an Autonumber primary key named "ID", you could find
the
record again after a Requery like this:

Dim rs As DAO.Recordset
Dim varID as Variant

varID = Me.ID 'Save the primary key value.
Me.Requery 'Perform the requery

If IsNull(varID) Then 'Must have been a new record
If Not Me.NewRecord Then
RunCommand acCmdRecordsGotoNew
End If
Else
Set rs = Me.RecordsetClone
rs.FindFirst "ID = " & varID
If rs.NoMatch Then
MsgBox "It disappered"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to the newsgroup. (Email address has spurious "_SpamTrap")


2) Use the SelTop prop of the Form. See:
http://www.lebans.com/setgetsb.htm
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top