Passing Variables

whpacejr

Registered User.
Local time
Today, 02:23
Joined
May 26, 2006
Messages
4
Is it possible to pass variables between Private sub routines (modules) and functions? I've tried declaring variables as public and setting the value to the value of a field on a Form BeforeUpdate, but when I try to use them in a Private sub or Public Function the values are lost. For example, in the following code, projstatus does not change back to str_projstatus. Please note, I cannot use the BeforeUpdate for the projstatus object as it interferes with other routines onthe form. Any suggestions would be helpful.

Option Compare Database
Option Explicit
Public str_projstatus as String

Private Sub Form_BeforeUpdate(Cancel As Integer)
str_projstatus = projstatus 'where projstatus before update = "In-Progress"
End Sub

Public Function Proj_Save()
Dim Msg, Style, Title, Response, myString
If IsNull(supervisor) Then
projstatus = str_projstatus
Exit Function
'Else
End If
End Function

Private Sub projstatus_Change()
If rptstatus = "Completed" Then
Proj_Save
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom