Someone help me out here. I'm trying to assign a variable to store the current time which is used repeatedly throughout my form for various calcs. I tried to assign it in the startup module of the prog but after the main form is loaded it's lost. Tried assigning it as a Public Const but the module didn't like me using Now() outside of a function/sub. Then tried declaring the value on For Load and it still is blank when a sub requests it. Help.
Most recent incarnation(not working):
Code:
Sub Form_Load()
Dim objDateStart As Date
objDateStart = Now()
End Sub
Private Sub Command1_Click()
Date = objDateTemp = FileDateTime("C:\Program Files\Whatever")
Time = objDateTemp = FileDateTime("C:\Program Files\Whatever")
Call Shell("C:\Program Files\Whatever\run.exe", 1)
End Sub
Private Sub Command2_Click()
Dim intDaysRun As Long
Dim intTimeRun As Long
intDaysRun = DateDiff("d", Now(), objDateTemp)
intTimeRun = DateDiff("s", Now(), objDateTemp)
Date = DateAdd("d", intTimeRun, objDateStart)
Unload Me
End Sub
Thanks in advance.