Show Query fields in subform using option groups (1 Viewer)

Chrism2

Registered User.
Local time
Today, 09:02
Joined
Jun 2, 2006
Messages
161
Hi there

Is there any way to control the "show" criteria in a query from option groups... i.e... a check box for someone to say if they want to view items in the query or not? (But not to affect the actualy query data in any way).


Cheers!
 

Junkee Brewster

Registered User.
Local time
Today, 17:32
Joined
May 21, 2005
Messages
33
Hi Chrism2,

I'm not sure if I have understood what you want correctly.. But this method can allow you to display additional/hidden fields or subform(s) from a user mouseclick.

Open frmMain. You will see a check/tick box and a command button.

Command Button:

"Reveals" several new fields (belonging to the main form/main table) that can not be edited or deleted. Just for display.

There's an event procedure in the OnClick() property of the button.

These fields must be set to Hidden by: Properties>Format Tab>Visible>No
Also: Properties>Data>Enabled>No and
Properties>Data>Locked>Yes
This stops the user from "changing the data" and won't affect what you're doing on the current record etc.

Check Box:

The check box, when "ticked" reveals a subform (and vice versa). Same principle. The subform is set to Visible>No by default.

There is an event procedure in the AfterUpdate() property of the checkbox

To BLOCK users from deleting, editing etc on the subform, set the SUBFORM properties by going to Properties>Data and:

AllowEdits
AllowDeletions
AllowAdditions
DataEntry are all set to NO.

You can use VB as well to toggle the Allowedits... properties as well so users can edit the data, say, by having to click another button to confirm.

P.S - I've just banged this together using mostly MS wizards so is ugly as sin and I've not bothered to label correctly.. but it works, and you can see how to do it I think.

HTH - Junkee :)
 

Attachments

  • ViewHiddenFields.zip
    33.6 KB · Views: 112

Junkee Brewster

Registered User.
Local time
Today, 17:32
Joined
May 21, 2005
Messages
33
Hi Chrism2,

I've been thinking - I should've showed you how to reveal hidden fields on an existing, VISIBLE subform (because that's what you probably wanted all along! Ah duh Junkee - it's been a long day, what can I say?)

So, look at frmSubWithHidden for the example.

Same principle as above... command button to do the work with some VB behind it.

This is also important so you know how to refer to subforms in VB

If you want the last 2 fields on the sub to be editable for the user, then make sure Enabled = Yes and Locked = No, because right now, I've got the fields "blocked".

Laterz.
 

Attachments

  • ViewHiddenFields2.zip
    48.1 KB · Views: 108

Chrism2

Registered User.
Local time
Today, 09:02
Joined
Jun 2, 2006
Messages
161
Many, many thanks - that is more or less what I want to do.

I'm struggling to implement it though.

I take it this doesn't work in datasheet view. (I've attached what I have done - and even in form view it's not functioning as yours does.) Can you point me in the right direction here?

frmDisplayResults is where I'm working. It's all rough around the gills at the moment.

Additionally, what would be the right way to pull up the form [frmSaleInput] with current selected record in [frmDisplayResults]? I've tried a manner of things and hashed it.

Thanks so much your help.
 

Attachments

  • 110806.zip
    170.4 KB · Views: 165

Junkee Brewster

Registered User.
Local time
Today, 17:32
Joined
May 21, 2005
Messages
33
Chrism2

No, it won't work in datasheet view.

So, basically, you want your users to use all of those checkboxes to select which fields to view/hide, and then, once they click the "view" button, those multiple fields selected will show/hide?

One thing, the problem with this method, is the fields will just "disappear", but the remaining fields will not all slide together next to each other. There will be blank gaps where the fields used to be (the same size as the field that has been hidden). A bit patchwork. Just so you know. There are ways around it but it's a bit of work! But I'll give it some thought.

Let me know these few little things, and I'll skip to it tomorrow (sorry to make you wait - it's getting very late and I full have a headache.. but I will do it tomorrow after work OK?)

Cheers - Junkee :)
 

Chrism2

Registered User.
Local time
Today, 09:02
Joined
Jun 2, 2006
Messages
161
Thanks so much - there's no hurry - this is a pet project (I.e. Me trying to be clever) :-S

Indeed, as you say, when there is a tick, they can see the field, if it is not, it is hidden.

However. If they don't slide together... i.e. in Form view only - the point is a little defeated. :-(. (The idea was to present the data in form view as user-friendly as possible without having people using the built in hide/unhide facility.

Could the problem be solved by limiting the query fields in some way? Is there a better way to approach the problem? :) I daresay I've tackled it from the wrong perspective.

Again, thankyou for your help.
 

Chrism2

Registered User.
Local time
Today, 09:02
Joined
Jun 2, 2006
Messages
161
Thanks so much - there's no hurry - this is a pet project (I.e. Me trying to be clever) :-S

Indeed, as you say, when there is a tick, they can see the field, if it is not, it is hidden.

However. If they don't slide together... i.e. in Form view only - the point is a little defeated. :-(. (The idea was to present the data in form view as user-friendly as possible without having people using the built in hide/unhide facility.

Could the problem be solved by limiting the query fields in some way? Is there a better way to approach the problem? :) I daresay I've tackled it from the wrong perspective.

Again, thankyou for your help.
 

Users who are viewing this thread

Top Bottom