Open Form from Datasheet to a Specific Record

R

rm

We have two forms. One is a datasheet. One is a form with a default
view of Single Form.

We want to have the user select (double click) on a record in the
datasheet and have the second form open to that record.

I can figure out which record the user selected and how to open the
second form. I dont know how to have to second form open to a specific
record.

Any ideas?
 
R

Rick Brandt

rm said:
We have two forms. One is a datasheet. One is a form with a default
view of Single Form.

We want to have the user select (double click) on a record in the
datasheet and have the second form open to that record.

I can figure out which record the user selected and how to open the
second form. I dont know how to have to second form open to a specific
record.

Any ideas?

The OpenForm method has an argument for a WHERE clause. You use that to
specify a filter to apply. That claue can make a reference to a value in
the datasheet form.

EX:
DoCmd.OpenForm "FormName",,,"ID = " & Me!ID
 
R

rm

The OpenForm method has an argument for a WHERE clause.  You use that to
specify a filter to apply.  That claue can make a reference to a value in
the datasheet form.

EX:
DoCmd.OpenForm "FormName",,,"ID = " & Me!ID

Worked perfect. Thank you!

My question now (sorry for being greedy) is how do I requery
(refresh) the original datasheet form so that if the user adds a new
record in the single form then the new record is displayed in the
original?
 
K

Klatuu

One way would be to use the Activate event of the datasheet form to requery it.
The Activate event will fire each time the form becomes the active fom.
 

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