command buttons to switch forms

G

Guest

How do I build command buttons to switch forms while keeping the same record
selected?

In detail: I have an overview that uses continuous forms showing just a few
fields per record (say ID, Name, phone, based on tblUser) and want to define
command buttons that allow the user to see the details for the record (a form
with many, many fields, - as an example, ID, Name, Phone, address, city, and
state, based on the same tblUser). It’s easy to build the command button to
show the details for the record that the user has selected – the wizard does
that well. However, how do I built a command button to take the user back the
original record in the summary, and not to the first record in the summary?
 
L

Larry Linson

Twas said:
How do I build command buttons to switch forms while keeping the same
record
selected?

In detail: I have an overview that uses continuous forms showing just a
few
fields per record (say ID, Name, phone, based on tblUser) and want to
define
command buttons that allow the user to see the details for the record (a
form
with many, many fields, - as an example, ID, Name, Phone, address, city,
and
state, based on the same tblUser). It's easy to build the command button
to
show the details for the record that the user has selected - the wizard
does
that well. However, how do I built a command button to take the user back
the
original record in the summary, and not to the first record in the
summary?

If you just leave that selection form open, when you close the detail form,
the same record should be selected. If you have a compelling need to close
the selection form, then pass the record ID via the OpenArgs argument in the
DoCmd.OpenForm that you use to open it, and put code in the Open event to
locate the Record... something like the following _untested_ air code (which
assumes the unique ID of the record is numeric, is named RecID, and that its
the only thing you pass in OpenArgs):


Me.RecordSetClone.MoveFirst
Me.RecordSetClone.FindFirst "[RecId] = " & OpenArgs
If Not Me.RecordSetClone.NoMatch
Me.Bookmark = Me.RecordsetClone.Bookmark
Else
MsgBox "Unable to find Record with RecID of " & OpenArgs
End If

Larry Linson
Microsoft Access MVP
 

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