call up second event proceedure within the first one

rainbows

Registered User.
Local time
Today, 00:30
Joined
Apr 21, 2017
Messages
428
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
 
Put the first code into its own sub and call from both places.
Always better to give controls meaningful names as opposed to command51. :(
 
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.
 
Sorry, I meant a sub in the form module. :(
 

Users who are viewing this thread

Back
Top Bottom