call up second event proceedure within the first one (1 Viewer)

rainbows

Registered User.
Local time
Yesterday, 20:02
Joined
Apr 21, 2017
Messages
425
Code:
Private Sub Command51_Click()
On Error GoTo Err_Handler
    
    Const FOLDER_EXISTS = 75
    Const MESSAGE_TEXT1 = "No current product ."
    Const MESSAGE_TEXT2 = "No folder set for storing PDF files."
    Dim strFullPath As String
    Dim varfolder As Variant
    Dim ECN As String


The above is part of the code that sends a report to a file on the server

the code below is what someone helped me with which works great

how can i get the code below to call up the code above after the first code has moved the data to the table

Code:
Option Explicit
Option Compare Database
Private Sub Material_AfterUpdate()
Dim OldValue As String
Dim NewValue As String
Dim MaterialID As Double
MaterialID = Me.MaterialID
OldValue = Me.Material.OldValue
NewValue = Me.Material
DoCmd.RunSQL "INSERT INTO TblDataChanges ( MaterialID, ChangeDate, ControlName, OldValue, NewValue ) VALUES ('" & MaterialID & "',Now(),'Material' ,'" & OldValue & "', '" & NewValue & "');"
Exit Sub
End Sub

thanks steve
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:02
Joined
Sep 21, 2011
Messages
14,317
Put the first code into its own sub and call from both places.
Always better to give controls meaningful names as opposed to command51. :(
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 22:02
Joined
Feb 28, 2001
Messages
27,193
One last comment, because Gasman's suggestion is right. Beware if you are calling the common sub from a general module, since "Me." prefixes don't work in code residing in general modules. HOWEVER, if the common sub is in the same form's class module as the things calling it, you should be OK.
 

Gasman

Enthusiastic Amateur
Local time
Today, 04:02
Joined
Sep 21, 2011
Messages
14,317
Sorry, I meant a sub in the form module. :(
 

Users who are viewing this thread

Top Bottom