subform - click on control

  • Thread starter Thread starter David Norman
  • Start date Start date
D

David Norman

How do I put a "check box' (or something similar) next to each record
that appears in a subform so that the user can click on it and see a
new related form that expand the information.

eg if the customer(main form) is Pizza Hut and the subform lists all
their locations, I want the user to click on a check box for a
specific location and see all the related information for that
location (from another table or form)

Thanks
 
first, suggest you don't use a checkbox. because it will be an unbound
control, when you check the box in one record in a continuous (or datasheet)
subform, it will look like you've checked *all* the records - very confusing
to your users.
instead, you might put the code to open the "location details" form on the
location field's double-click event. so if i want to see this location, i
double-click the location number and the detail form pops open.

as for the code itself: your subform's underlying "locations" table should
have a primary key field that uniquely identifies each record. i'll call it
LocID. the OpenForm action needs to include a WHERE condition (see Help for
details, for macros or VBA code) that refers to that unique ID to filter for
the single record you want, something like

"[LocID] = " & Forms!MainFormName!SubformControlName!LocID

in VBA, or

[LocID] = [Forms]![MainFormName]![SubformControlName].Form![LocID]

in a macro.

hth
 
tina said:
first, suggest you don't use a checkbox. because it will be an unbound
control, when you check the box in one record in a continuous (or datasheet)
subform, it will look like you've checked *all* the records - very confusing
to your users.
instead, you might put the code to open the "location details" form on the
location field's double-click event. so if i want to see this location, i
double-click the location number and the detail form pops open.

as for the code itself: your subform's underlying "locations" table should
have a primary key field that uniquely identifies each record. i'll call it
LocID. the OpenForm action needs to include a WHERE condition (see Help for
details, for macros or VBA code) that refers to that unique ID to filter for
the single record you want, something like

"[LocID] = " & Forms!MainFormName!SubformControlName!LocID

in VBA, or

[LocID] = [Forms]![MainFormName]![SubformControlName].Form![LocID]

in a macro.

hth


David Norman said:
How do I put a "check box' (or something similar) next to each record
that appears in a subform so that the user can click on it and see a
new related form that expand the information.

eg if the customer(main form) is Pizza Hut and the subform lists all
their locations, I want the user to click on a check box for a
specific location and see all the related information for that
location (from another table or form)

Thanks


Many thanks for the help. Should work fine
N.
 
Back
Top