Open Form to Specific Record without filter

G

Guest

I think this should be an easy one, but I can't find the answer.

I currently have command buttons on forms that take the user to the same
record on other forms. This works fine. No problems.

A user recently requested that when the other form opens, the current record
is "displayed", but all records are available (that is, not filtered). Of
course the user can easily remove the filter (I've even provided a button for
that), but that takes him back to record number 1.

So what I want to do is have the command button take the user to a new form
and, without filtering, display the record from the previous form.

Thanks for your help!
Diane
 
A

Albert D.Kallal

As mentioned, the normal code to do this is

docmd.OpenForm "frmcustomer",,,"id = " & me!id

As you mention, the above will open the form to ONE record. You *really*
should try and keep this design, as it makes no sense to pull tons of
records into a form..and NOT use the data.

However, you can do as you ask.....

You can go

Dim strf As String

Me.Refresh
strf = "tblAnswers"
DoCmd.OpenForm strf
Forms(strf).Recordset.FindFirst "id = " & Me!ID


So, the above will *move* the form to the same record.....

note that any time you launch another form to the same record..you REALLY
REALLY want to force a disk write before you do that
(hence, note the use of me.refresh before the open form to write things to
disk...).
 

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