Open subform to specific record

G

Guest

I'm trying to create a macro to open a subform to the record that was
double-clicked.

I've got a macro set on the OnDblClick property as follows:

Action: OpenForm
Form Name: Reservations_subform
Where condition:
[Reservations]![ReservationID]=[Forms]!Reservations_subform[ReservationID].form

What I want it to do is when you double-click on the Reservation ID in the
subform datasheet, it opens the subform in form view to that specific record.
What the above macro does is open a parameter box. If I enter the
Reservation ID number into the parameter box, it opens the correct record.
However, I don't want that extra step in there (the parameter box). Is there
a way to avoid this?
 
S

Steve Schapel

Miranda,

If you mean to open, in Form view, the same form that you are using as
the subform... hmmm, I wouldn't do it like that.

Anyway, the syntax is wrong in the Where Condition argument of the
macro. If I understand you correctly, it should be like this...
[ReservationID]=[Forms]![NameOfYourMainForm]![Reservations_subform]![ReservationID]
 
G

Guest

Thanks. Works perfectly.
--
Miranda


Steve Schapel said:
Miranda,

If you mean to open, in Form view, the same form that you are using as
the subform... hmmm, I wouldn't do it like that.

Anyway, the syntax is wrong in the Where Condition argument of the
macro. If I understand you correctly, it should be like this...
[ReservationID]=[Forms]![NameOfYourMainForm]![Reservations_subform]![ReservationID]

--
Steve Schapel, Microsoft Access MVP
I'm trying to create a macro to open a subform to the record that was
double-clicked.

I've got a macro set on the OnDblClick property as follows:

Action: OpenForm
Form Name: Reservations_subform
Where condition:
[Reservations]![ReservationID]=[Forms]!Reservations_subform[ReservationID].form

What I want it to do is when you double-click on the Reservation ID in the
subform datasheet, it opens the subform in form view to that specific record.
What the above macro does is open a parameter box. If I enter the
Reservation ID number into the parameter box, it opens the correct record.
However, I don't want that extra step in there (the parameter box). Is there
a way to avoid this?
 

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