getting before update event on form to fire when used as subform (1 Viewer)

captain soco

New member
Local time
Today, 11:00
Joined
Jul 20, 2016
Messages
4
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 :banghead:, and do not command a veteran SQL knowledge base to script my way out of this.

Any advice or help would be greatly appreciated
 

Minty

AWF VIP
Local time
Today, 19:00
Joined
Jul 26, 2013
Messages
10,367
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.
 

captain soco

New member
Local time
Today, 11:00
Joined
Jul 20, 2016
Messages
4
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?
 

Minty

AWF VIP
Local time
Today, 19:00
Joined
Jul 26, 2013
Messages
10,367
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 .
 

captain soco

New member
Local time
Today, 11:00
Joined
Jul 20, 2016
Messages
4
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>
 

Minty

AWF VIP
Local time
Today, 19:00
Joined
Jul 26, 2013
Messages
10,367
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?
 

Users who are viewing this thread

Top Bottom