open form, show all records but go to a specific record

open form, show all records but go to a specific record

Post by Paul » Thu, 14 Feb 2008 05:43:48


I'm using the following code in the Click Event of a list box in one form to
open another form and go to a specific record:

stDocName = "frmActivity"
stLinkCriteria = "[ProjectID]=" & Me!List2
DoCmd.OpenForm stDocName, , , stLinkCriteria

The problem with this operation is that it does more than simply go to a
specific record - it also filters the recordset to display only that record.

How can I modify that code so that it selects the desired record in the
form, without filtering the recordset so that all of the records are
available in the form?

Thanks in advance,

Paul
 
 
 

open form, show all records but go to a specific record

Post by cm9nZX » Thu, 14 Feb 2008 06:36:02

DoCmd.OpenForm ("frmMAINFORM") ' open mainform
DoCmd.GoToControl "ItemID" ' goto record number control
DoCmd.FindRecord lngItemID ' find our record

 
 
 

open form, show all records but go to a specific record

Post by Paul » Thu, 14 Feb 2008 09:00:36

Works great, Roger.

I was having trouble getting GoToControl to work, so I used
Forms!frmActivity!ProjectID.SetFocus on that line and it runs without a
hitch.

Thanks for giving me a solution to the problem.