Open Form from Datasheet to a Specific Record

  • Thread starter Thread starter rm
  • Start date Start date
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?
 
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
 
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?
 
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.
 
Back
Top