UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Is it possible to trigger the event of a control on a subform, f    
 
   
pjhartley
post May 30 2006, 12:34 PM
Post #1

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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
Go to the top of the page
 
+
niesz
post May 30 2006, 12:37 PM
Post #2

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



See if this thread helps any...
Go to the top of the page
 
+
pjhartley
post May 30 2006, 02:06 PM
Post #3

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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
Go to the top of the page
 
+
niesz
post May 30 2006, 03:00 PM
Post #4

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



No problem. Glad to help.
Go to the top of the page
 
+
MikeLyons
post May 30 2006, 03:46 PM
Post #5

UtterAccess VIP
Posts: 1,857
From: BC, Canada



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
Go to the top of the page
 
+
pjhartley
post May 30 2006, 06:04 PM
Post #6

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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
Go to the top of the page
 
+
niesz
post May 30 2006, 06:10 PM
Post #7

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



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.
Go to the top of the page
 
+
pjhartley
post May 30 2006, 06:22 PM
Post #8

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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.
Go to the top of the page
 
+
mishej
post May 30 2006, 07:36 PM
Post #9

Retired Moderator
Posts: 11,289
From: Milwaukee, WI



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.
Go to the top of the page
 
+
pjhartley
post May 31 2006, 06:43 AM
Post #10

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



Thats a valid point too John, i'll look into that, thanks.
Go to the top of the page
 
+
pjhartley
post May 31 2006, 06:46 AM
Post #11

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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
Go to the top of the page
 
+
niesz
post May 31 2006, 07:05 AM
Post #12

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



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.
Go to the top of the page
 
+
pjhartley
post May 31 2006, 02:21 PM
Post #13

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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
Go to the top of the page
 
+
niesz
post May 31 2006, 02:33 PM
Post #14

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



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.
Go to the top of the page
 
+
pjhartley
post May 31 2006, 06:07 PM
Post #15

UtterAccess Member
Posts: 36
From: Uk, Warwickshire



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?
Go to the top of the page
 
+
niesz
post May 31 2006, 06:19 PM
Post #16

Utter A-fishin'-ado
Posts: 17,723
From: Cincinnati, Ohio, USA . . . ><((((°>



See if anything in this post helps.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 08:17 PM