OpenForm using WhereCondition - I'm confused

M

MC

I have a Form containing a Datasheet Subform. The subform is correctly
filtered based on the record in the main form.

Can someone please tell me the exact code I need so that when I select a
record in the datasheet subform a different form will open showing the
correct record as filtered by the selected record in the subform. Also,
where exactly do I place this event procedure.

The mainform name is "Info"
The subform is "qryBookingfrm" (based on a query "qryBooking)
The new form to open is "Client"

The record in the newly opened form will be filtered by the field name
"ClientLastName" This field name is present in both "qryBookingfrm" and
"Client" so there should be no problem there.

I am so confused and am getting in a right muddle with all this OpenForm and
WhereCondition business.

Thanks in advance.

MC
 
A

Albert D. Kallal

Place the button in the sub-form (that sub-form needs to be a continues
form).

The code behind the button needs to be:

me.Refresh
docmd.OpenForm "Client",,,"id = " & me.ID

The above assumes that you have a key id called "id". Note how we write the
reocrd to disk BEFORE we launch the form. You can remove the "me.refresh" if
users do not edit those records in a sub form.

For some screen shots of how the button should look, and also for some
screen shots that use the above code...take a look at:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm
 
M

MC

Albert D. Kallal said:
Place the button in the sub-form (that sub-form needs to be a continues
form).

The code behind the button needs to be:

me.Refresh
docmd.OpenForm "Client",,,"id = " & me.ID

The above assumes that you have a key id called "id". Note how we write the
reocrd to disk BEFORE we launch the form. You can remove the "me.refresh" if
users do not edit those records in a sub form.

For some screen shots of how the button should look, and also for some
screen shots that use the above code...take a look at:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm

Thanks

MC
 

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