"Highlighting" user's active subform selection

R

rawdstorage

I have a textbox which I would like to fill with content from
different subform fields. Whenever a user clicks a cell within the
subform which is displayed in table format, the textfield should
display the content.

Is this possible to do? Perhaps I am just able to extract info like
this from varchar fields?

The reason I want to do this is that I have a huge subform-table with
many columns, some of which are filled with content that don't fit in
the narrow space they have been assigned (too many columns, all of
them won't fit at optimal individual size). I thought adding a
"verbose" textbox that can hold and display the info is a clever
solution, as long as it's possible to connect the subform with it- or
rather a celll within the subform.

Thanks!
 
T

Tom van Stiphout

On Thu, 27 Nov 2008 09:39:41 -0800 (PST), (e-mail address removed) wrote:

Subforms don't have a "table format"; I assume you mean datasheet
format.
You would have to write code in the click event of each field of the
subform to populate that textbox. Something like:
Me.Parent.myTextbox.Value = Me.MyControl.Value

What if the user is more keyboard-centric? You may want to rethink
that click event.

-Tom.
Microsoft Access MVP
 
R

rawdstorage

Thank you for your swift reply!

Yes, of course I mean datasheet format, still new at this since last
week or so (and with a non-English copy of Access ;).
To check I have understood this correctly, if my subform is called
"FilteredSubform" and my textbox "VerboseTextbox" in my case the
syntax would be:
"Me.Parent.VerboseTextbox.Value = Me.FilteredSubform.Value"? I still
find it quite amazing it works like that! As I understand it, I would
need to add an FilteredSubform_Click() event handler, but it's still
wonderous how the entire subform control adopts the value of whatever
is being clicked within that control. =)

True, keyboard oriented users will be more at a loss, but this textbox
feature is more of a "luxury" feature I am adding, I suppose they will
have to be more mouse-oriented in this case. The subform is there
merely to act as a back-end auditing tool to check the filters are
filtering as expected, since all the info in the subform will be
transported to a report and printed with clear layout from there at a
later stage. (I am hoping I can save a filtered query I can set as row
src for the report by doing some elegant VBA).

Thanks again!

Best regards,
R
 
T

Tom van Stiphout

On Fri, 28 Nov 2008 00:46:21 -0800 (PST), (e-mail address removed) wrote:

As I wrote in first instance:
You would have to write code in the click event of *each* field of the
subform.

Rather than the click event, consider the <control>_OnEnter event.

-Tom.
Microsoft Access MVP
 
R

rawdstorage

I completely missed that detail about each field, thanks for
emphazising that. It would be far too work intensive to have that for
each field, unless I come up with a sort of loop that can write that
code for me based on form field index or something similar.

However, when I run the code below, I get an error saying "Compile
error: Cannot find method or dataobject member" with the last ".Value"
highlighted.

Private Sub FilteredSubform_OnEnter()
Me.Parent.VerboseTextbox.Value = Me.FilteredSubform.Value
End Sub

Removing that last ".Value" removes the error, but the textbox value
is not updated with whatever I have click on in the subform. Similarly
and more importantly I get an error saying I have misused the "!" or
"." separators when declaring

Dim CompanySelected As Integer
CompanySelected = [CompanyListbox].Value

and the error remains after I change the code to
CompanySelected = Me.CompanyListbox.Value

and continues to be there even after I comment out the last bit like
CompanySelected = Me.CompanyListbox '.Value

I am not sure I am seeing this the right way, but I get the impression
both failing features have to do with failure to reference to my
controls properly. Is this assumption correct, or am I missing
something else?

Thanks in advance!
 
A

angéline dubuget

j'e recherche sex agresssion niqué
<[email protected]> a écrit dans le message de

I completely missed that detail about each field, thanks for
emphazising that. It would be far too work intensive to have that for
each field, unless I come up with a sort of loop that can write that
code for me based on form field index or something similar.

However, when I run the code below, I get an error saying "Compile
error: Cannot find method or dataobject member" with the last ".Value"
highlighted.

Private Sub FilteredSubform_OnEnter()
Me.Parent.VerboseTextbox.Value = Me.FilteredSubform.Value
End Sub

Removing that last ".Value" removes the error, but the textbox value
is not updated with whatever I have click on in the subform. Similarly
and more importantly I get an error saying I have misused the "!" or
"." separators when declaring

Dim CompanySelected As Integer
CompanySelected = [CompanyListbox].Value

and the error remains after I change the code to
CompanySelected = Me.CompanyListbox.Value

and continues to be there even after I comment out the last bit like
CompanySelected = Me.CompanyListbox '.Value

I am not sure I am seeing this the right way, but I get the impression
both failing features have to do with failure to reference to my
controls properly. Is this assumption correct, or am I missing
something else?

Thanks in advance!
 
R

rawdstorage

I managed to not only create one but several groups with different
formatting. I did not make it look like I first was hoping for, but it
still looks good. Instead I added a second group with a formatting of
its own and the layout still manages to convey a sense for where the
different sections and sub-sections have their boundaries. Thanks for
the help!


I completely missed that detail about each field, thanks for
emphazising that. It would be far too work intensive to have that for
each field, unless I come up with a sort of loop that can write that
code for me based on form field index or something similar.

However, when I run the code below, I get an error saying "Compile
error: Cannot find method or dataobject member" with the last ".Value"
highlighted.

Private Sub FilteredSubform_OnEnter()
    Me.Parent.VerboseTextbox.Value = Me.FilteredSubform.Value
End Sub

Removing that last ".Value" removes the error, but the textbox value
is not updated with whatever I have click on in the subform. Similarly
and more importantly I get an error saying I have misused the "!" or
"." separators when declaring

Dim CompanySelected As Integer
CompanySelected = [CompanyListbox].Value

and the error remains after I change the code to
CompanySelected = Me.CompanyListbox.Value

and continues to be there even after I comment out the last bit like
CompanySelected = Me.CompanyListbox '.Value

I am not sure I am seeing this the right way, but I get the impression
both failing features have to do with failure to reference to my
controls properly. Is this assumption correct, or am I missing
something else?

Thanks in advance!

As I wrote in first instance:
You would have to write code in the click event of *each* field of the
subform.
Rather than the click event, consider the <control>_OnEnter event.
-Tom.
Microsoft Access MVP
- Visa citerad text -- Dölj citerad text -

- Visa citerad text -
 

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