Show selected record in normal form view.

S

Silvio

First of all, I am sure the answer is somewhere in this helpful forum but I
am not sure what words to use to find it. So, this is what I am trying to do:
I have a form that is used as control to filter data from a query and show
the result in a subform (Seach records). The retrieved data is my subform is
displayed as datasheet (raw) view and that is fine. However, since each
record has so much data in it, I would like to be able to double click on
that raw and show that specific record in a pop-up Single Form view. As far I
can see, I guess I need to create a regular form based on my table the way I
want it to look like and then, since each record has a unique record ID,
write a code to run when double clicking a raw or something like that. Since
each record has a unique record ID, I can use it as control to open the other
Form (Single Form) and show only that record. Am I on the right track?
If so, I need assistance on write such code. Please be as specific as you
can since it has been a long time since I have done some programming in
Access. If you have a good example doing exactly what I am looking for,
please feel free to e-mail it to me @ [email protected]

Thank you.
 
M

Marshall Barton

Silvio said:
First of all, I am sure the answer is somewhere in this helpful forum but I
am not sure what words to use to find it. So, this is what I am trying to do:
I have a form that is used as control to filter data from a query and show
the result in a subform (Seach records). The retrieved data is my subform is
displayed as datasheet (raw) view and that is fine. However, since each
record has so much data in it, I would like to be able to double click on
that raw and show that specific record in a pop-up Single Form view. As far I
can see, I guess I need to create a regular form based on my table the way I
want it to look like and then, since each record has a unique record ID,
write a code to run when double clicking a raw or something like that. Since
each record has a unique record ID, I can use it as control to open the other
Form (Single Form) and show only that record. Am I on the right track?
If so, I need assistance on write such code. Please be as specific as you
can since it has been a long time since I have done some programming in
Access. If you have a good example doing exactly what I am looking for,
please feel free to e-mail it to me @ [email protected]


You are on the right track. The key is to use the OpenForm
method's WhereCondition argument to filter the popup form's
data. The general idea is something like:

strWhere = "PKfield=" & Me.Pkfield
DoCmd/OpenForm "popupform", , , strWhere
 
S

Silvio

I am, not sure if you got my previous message or not. Your suggestion works
great. Thinking further, can I do the same thing if instead of opening a new
form I can instead use a SubForm from my main form? If so, how the sintax
looks like?

Thank you much.
 
M

Marshall Barton

Doing the equivalent for a subform can not use that approach
because you do not open a subform. That means that there is
no such thing as "the same thing".

Typically a subform is set up to synchronize with the
mainform's current record by the subform control's Link
Master/Child Fields properties. Since you seem to want to
synchronize the datasheet subform and this new single view
subform, you need a line of code in the datasheet subform's
Current event. The code would set a hidden text box (name
it txtLink) in the main form's header or footer section.
Parent.txtLink = Me.Pkfield

Then set the single view subform's Link Master property to
txtLink and the Link Child to Pkfield.

With this arrangement, the single view subform will
automatically sync with the datasheet subform's record as
you navigate through them. At least I think this is what
you want.
 
S

Silvio

mmmmhhhhhh this "sound" to complex for my modest child-stepping knowledge.
Thank you for your help :)

Marshall Barton said:
Doing the equivalent for a subform can not use that approach
because you do not open a subform. That means that there is
no such thing as "the same thing".

Typically a subform is set up to synchronize with the
mainform's current record by the subform control's Link
Master/Child Fields properties. Since you seem to want to
synchronize the datasheet subform and this new single view
subform, you need a line of code in the datasheet subform's
Current event. The code would set a hidden text box (name
it txtLink) in the main form's header or footer section.
Parent.txtLink = Me.Pkfield

Then set the single view subform's Link Master property to
txtLink and the Link Child to Pkfield.

With this arrangement, the single view subform will
automatically sync with the datasheet subform's record as
you navigate through them. At least I think this is what
you want.
--
Marsh
MVP [MS Access]

I am, not sure if you got my previous message or not. Your suggestion works
great. Thinking further, can I do the same thing if instead of opening a new
form I can instead use a SubForm from my main form? If so, how the sintax
looks like?
 
M

Marshall Barton

It may sound that way when you're not familiar with the
concepts, but it really is pretty straightforward. One text
box, one line of code and a couple of property settings.
Think of it as just dipping your toes in the water :)
 
Top