Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-20-2016, 08:38 AM   #1
captain soco
Newly Registered User
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
captain soco is on a distinguished road
Unhappy getting before update event on form to fire when used as subform

so I was pretty excited to figure out how to use the before update macro to register the last touch user and date for any record that was edited in my forms.

When I embedded one form within the other as a subform, the before update event no longer fired on the subform. There is no option to create an update event for the subform to enter a USERID or NOW into the specific fields if anything on the subform is edited.

I need some help because I am getting a little frustrated as ive hit a wall , and do not command a veteran SQL knowledge base to script my way out of this.

Any advice or help would be greatly appreciated

captain soco is offline   Reply With Quote
Old 07-20-2016, 08:48 AM   #2
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,284
Thanks: 151
Thanked 1,683 Times in 1,655 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: getting before update event on form to fire when used as subform

Have you double checked that the Before update event doesn't fire? I'm sure it does on a subform. Be aware that any Event won't fire if you are using code or a macro to make the update to the subform.
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 07-20-2016, 08:52 AM   #3
captain soco
Newly Registered User
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
captain soco is on a distinguished road
Re: getting before update event on form to fire when used as subform

Minty,

Thanks for the reply.

I am using a macro to setvalue of the two "lasttouch" fields (user and time).

Are you saying because they are triggered by a macro when in form, this will not fire in subform mode when any field in a record is updated?

captain soco is offline   Reply With Quote
Old 07-20-2016, 08:58 AM   #4
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,284
Thanks: 151
Thanked 1,683 Times in 1,655 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: getting before update event on form to fire when used as subform

As a test - Assume you have a before update event in Subform1 on a textbox control called txtFlibble that simply puts up a message box ;

MsgBox "Flibble Value Updated!" , VbInformation

Using either simple VBA code or a macro set a value on the subform control. You will see the event in not fired. This is true of any Event sub form or main form .
__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 07-20-2016, 09:08 AM   #5
captain soco
Newly Registered User
 
Join Date: Jul 2016
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
captain soco is on a distinguished road
Re: getting before update event on form to fire when used as subform

not sure I follow your logic, however that is inconsequential.

Do you have a viable work around for me?

Once again, I have a subform that displays information based on a linked field to the main form, and if any field in the subform is updated, I want the current time and current user info to be automatically entered into their respective fields for auditing purposes.

When the form is used as the subform, this does not fire and I cannot find another option to have a singular subform field update based on any subform field updates regardless of mainform status.

Any ideas?

Event="BeforeUpdate"><Statements><Action Name="SetValue"><Argument Name="Item">[Forms]![COMPOSITE RETURNS]![Last touch Date:]</Argument><Argument Name="Expression">Now()</Argument></Action><Action Name="OpenForm"><Argument Name="FormName">frmCurrentUser</Argument><Argument Name="DataMode">Read Only</Argument><Argument Name="WindowMode">Hidden</Argument></Action><Action Name="SetValue"><Argument Name="Item">[Forms]![COMPOSITE RETURNS]![Last Touch User:]</Argument><Argument Name="Expression">[Forms]![frmCurrentUser]![UserID]</Argument></Action></Statements></UserInterfaceMacro></UserInterfaceMacros>
captain soco is offline   Reply With Quote
Old 07-20-2016, 02:35 PM   #6
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 6,284
Thanks: 151
Thanked 1,683 Times in 1,655 Posts
Minty is a jewel in the rough Minty is a jewel in the rough Minty is a jewel in the rough
Re: getting before update event on form to fire when used as subform

Okay - I'm afraid I don't use macro's but Subform events definitely do fire if the input is made on the Subform as far as VBA is concerned.

If your macro is setting data on the sub form why not make it enter the data into the audit record at the same time?

__________________
If we have helped please add to our reputation - click the scales symbol on the left, tick 'I approve' and leave a comment.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Reply

Tags
access 2013 , before update , not firing , subform event

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subform event to update automaticaly Form Leo_Polla_Psemata Modules & VBA 3 03-18-2015 06:56 AM
Subform Enter event does not fire as expected Rx_ Modules & VBA 9 07-03-2012 12:12 PM
Return to Main form from second form - Event wont fire Rx_ Forms 2 09-08-2010 06:28 AM
To fire Double Click event of Subform from Main Form Savita General 2 09-06-2007 05:29 AM
To fire Double Click event of Subform from Main Form Savita Forms 1 09-05-2007 09:26 AM




All times are GMT -8. The time now is 10:21 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World