pjhartley
May 30 2006, 12:34 PM
I was thinking along the lines of raise event (Mainform.SubForm.Control.EventName).
Depending on the value selected in a main form, i want it to trigger the event of a button in the subform. Is this possible?
Many thanks
Paul
niesz
May 30 2006, 12:37 PM
See if
this thread helps any...
pjhartley
May 30 2006, 02:06 PM
Neisz, thats perfect - you've saved me a lot of heartache - i was almost right, the syntax was getting a little fiddly and tiresome. You've come up with a wonder there, thanks bro.
Paul
niesz
May 30 2006, 03:00 PM
No problem. Glad to help.
MikeLyons
May 30 2006, 03:46 PM
A slightly more "clean" version of that technique is to just create a public Sub or function in the subform that does the work.
This becomes a "method" of the subform's class module and then you can call that from either the main form code OR in the event in the subform. In my opinion, event procedures should never be made public.
Mike
pjhartley
May 30 2006, 06:04 PM
Yes, thats an interesting take on things too - thanks for that.
I have another question, if you may - regarding the undo property of forms and subforms. I'm having problems whereby when a user wishes to undo some changes and revert to certain disabled controls (restore them) and previous data values etc. Is there anyway i can explicitly save changes, once they've perfomed a certain action, so that the undo option is not available? I'm finding in some cases by pressing the escape key its clearing more data than i would like it too. I know on exiting subforms the data is saved to the underlying table, thats fine - i've also experiemented a little with the dirty property, although this didn't produce the desired effect. I was looking for a more explicit way.
Thanks again
niesz
May 30 2006, 06:10 PM
If Me.Dirty Then Me.Dirty = False
..will save the current record. Just include this in an event where you need the Save to happen.
pjhartley
May 30 2006, 06:22 PM
Would this essentially be an explicit write to the underlying table - in effect wiping the undo values of a series of controls? I'll give that a go - thanks Niesz.
My problem is, that a drop-down list, on selection of a value, changes a subform control source. After its been changed, a user (or me right now) could press the escape key or undo button and try and revert back to the previous subform control source, and basically screw up the main form and subform. The drop down list and a few other controls would be pointing or indicating toward data on the orginal subform (because they've hit undo, when the subform is still pointing at the new source). I want to make so that once they changed the control source, an implicit save is made, meaning they can't revert with the undo button - but revert with a controlled process.
mishej
May 30 2006, 07:36 PM
When I see this type of request I generally think that the code in that desired event should be moved to a Public procedure in the form/report, or even a Public proc in a module.
That way you can call the proc from both the event's AfterUpdate and from wherever you would have raised that Event.
pjhartley
May 31 2006, 06:43 AM
Thats a valid point too John, i'll look into that, thanks.
pjhartley
May 31 2006, 06:46 AM
Is it possible to hide certain values or items within a listbox. Perhaps disable them or something similar?
Along the lines of
For iCount = 0 To 3
Me.Operation.ItemData(iCount).Visible = bPressItems
Next
For iCount = 4 To 6
Me.Operation.ItemData(iCount).Visible = Not (bPressItems)
Next
niesz
May 31 2006, 07:05 AM
No, you cannot hide values in a listbox. But you can rewrite the SQL for the rowsource to exclude the items you do not want to see, and then reset the rowsource.
pjhartley
May 31 2006, 02:21 PM
That worked like a dream, thanks Neisz - great idea.
Is it possible to programmatically fire the page up and page down event of a pagebreak control? Pageup and Pagedown keys are a bit wild and unpredictable (they change to the next record, if pressed multiple times, and i don't feel i can contain the users actions adequately) so i've trapped those in a keypress event, and disabled them.
When there is more information on a particular tab, i want to let the user know this, with a label that discreetly pops up, if they click on it, it will page down to the lower section of the tab ( i could add the data to another tab, although i want to keep the amount of tabs to a minimum, and keep those for dynamically binding subform control sources if the tab is selected.
Paul
niesz
May 31 2006, 02:33 PM
I really don't like pageup/pagedown solutions for forms with a lot of info on them. Depending on the end-user's screen resolutions you can get unexpected results because they may not see all that you intended. I would much rather just show a pop-up form.
pjhartley
May 31 2006, 06:07 PM
Yes, that's a good point Neisz. Do you know if its possible at all, with say a button?
I was thinking, maybe have a control button that programmatically moves the page down a section, i guess you could maybe resize if necessary according to screen dimensions perhaps?
niesz
May 31 2006, 06:19 PM
See if anything in
this post helps.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.