Jhart22889
Registered User.
- Local time
- Today, 14:45
- Joined
- Feb 22, 2013
- Messages
- 13
I have some code that allows fields on a form to be show or hidden based on the start and end date chosen. The code is called through the after update of the end date. I've also tried creating a module with just the hidden/not hidden criteria and calling the module with the if then statement with no luck. Using this method I get an error that says it expects a variable or procedure not a module. Here's a portion of the code:
Each month has 12 entries so the code above is repeated 12 times for January, 12 times for February, etc...
Any suggestions?
Code:
Dim ststartdate As Date
Dim stenddate As Date
Dim intdatediff As Integer
Dim strdatelookup As String
Dim Xstringstartday As String
ststartdate = Me.StartDate.Value
stenddate = Me.ProjectedEndDate.Value
'MsgBox ststartdate
'MsgBox stenddate
'If ststartdate Is Null Then
'MsgBox "Please fill in a start date"
'End If
intdatediff = DateDiff("d", ststartdate, stenddate)
strdatelookup = Left(ststartdate, 2)
strenddatelookup = Left(stenddate, 2)
If strdatelookup = "1/" And strenddatelookup = "2/" And intdatediff > 31 And intdatediff <= 59 Then
[tblDirectLaborCost subform].[Form]![January].ColumnHidden = False
[tblDirectLaborCost subform].[Form]![February].ColumnHidden = False
[tblDirectLaborCost subform].[Form]![March].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![March] = 0
[tblDirectLaborCost subform].[Form]![April].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![April] = 0
[tblDirectLaborCost subform].[Form]![May].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![May] = 0
[tblDirectLaborCost subform].[Form]![June].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![June] = 0
[tblDirectLaborCost subform].[Form]![July].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![July] = 0
[tblDirectLaborCost subform].[Form]![August].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![August] = 0
[tblDirectLaborCost subform].[Form]![September].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![September] = 0
[tblDirectLaborCost subform].[Form]![October].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![October] = 0
[tblDirectLaborCost subform].[Form]![November].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![ November] = 0
[tblDirectLaborCost subform].[Form]![December].ColumnHidden = True
[tblDirectLaborCost subform].[Form]![December] = 0
Each month has 12 entries so the code above is repeated 12 times for January, 12 times for February, etc...
Any suggestions?