Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

2,045 views
Skip to first unread message

Paul

unread,
Feb 12, 2008, 3:43:48 PM2/12/08
to
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

roger

unread,
Feb 12, 2008, 4:36:02 PM2/12/08
to
DoCmd.OpenForm ("frmMAINFORM") ' open mainform
DoCmd.GoToControl "ItemID" ' goto record number control
DoCmd.FindRecord lngItemID ' find our record

Paul

unread,
Feb 12, 2008, 7:00:36 PM2/12/08
to
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.

"roger" <ro...@discussions.microsoft.com> wrote in message
news:91B4274F-FD4C-4FCD...@microsoft.com...

0 new messages