NumbersMax
Board Regular
- Joined
- Jun 19, 2007
- Messages
- 200
Hello all!
I've been toying with a piece of code that I can't get to work...I got the ideas for this from part of various posts and I'm doing something wrong. At the moment, I get a Type Mismatch error on compile for (VarDate2 Is Null), but I have yet to get any test like this to work even when I wasn't getting an error.
Could someone check the code, please? I am an absolute novice at VBA
Basically, I don't want anyone to be able to touch that macro button (default not enabled) unless they first fill in the three date fields. Otherwise, they will be left waiting for the macro to give them absolutely zero data!
Any help-greatly appreciated!
Thanks,
Max
I've been toying with a piece of code that I can't get to work...I got the ideas for this from part of various posts and I'm doing something wrong. At the moment, I get a Type Mismatch error on compile for (VarDate2 Is Null), but I have yet to get any test like this to work even when I wasn't getting an error.
Could someone check the code, please? I am an absolute novice at VBA
Code:
Private Sub Form_AfterUpdate()
Dim VarDate, VarDate1, VarDate2 As Date
VarDate = Me.BeginDate
VarDate1 = Me.EndDate
VarDate2 = Me.FiscalYear
If (VarDate Is Null) Or (VarDate1 Is Null) Or (VarDate2 Is Null) Then
Me.Run_Art_Reporting_Macro_Button.Enabled = False
Else
Me.Run_Art_Reporting_Macro_Button.Enabled = True
End If
End Sub
Basically, I don't want anyone to be able to touch that macro button (default not enabled) unless they first fill in the three date fields. Otherwise, they will be left waiting for the macro to give them absolutely zero data!
Any help-greatly appreciated!
Thanks,
Max