Kumba1
Technical User
- Aug 29, 2002
- 94
I created a calendar form (actually looks like a calendar) in MS Access MDB that used dloopup and different pieces of code that now error in an ADP... the form is a 3x5 matrix of subforms, labeled form1 - form15, with each form being linked to text box that my code sets. Here is the code:
Private Sub Form_Load()
Dim x As Date
Dim y As Integer
'find out what next build date is based on scheduled builds
x = DMin("[BuildDate]", "tblBuilds", "[Built] = 0 and [inactive] = 0 and [location] <> ""Parts Room"""
y = Weekday(x) - 1
'check for a saturday
If y = 6 Then y = 5
'start populating
Do Until y = 16
If y = 1 Then
Forms!frmcal!rptcal1date = x
Forms!frmcal!rptCal1.Visible = True
GoTo nextbuilddate
ElseIf y = 2 Then
Forms!frmcal!rptcal2date = x
Forms!frmcal!rptCal2.Visible = True
GoTo nextbuilddate
ElseIf y = 3 Then
Forms!frmcal!rptcal3date = x
Forms!frmcal!rptCal3.Visible = True
GoTo nextbuilddate
ElseIf y = 4 Then
Forms!frmcal!rptcal4date = x
Forms!frmcal!rptCal4.Visible = True
GoTo nextbuilddate
ElseIf y = 5 Then
Forms!frmcal!rptcal5date = x
Forms!frmcal!rptCal5.Visible = True
GoTo nextbuilddate
ElseIf y = 6 Then
Forms!frmcal!rptcal6date = x
Forms!frmcal!rptCal6.Visible = True
GoTo nextbuilddate
ElseIf y = 7 Then
Forms!frmcal!rptcal7date = x
Forms!frmcal!rptCal7.Visible = True
GoTo nextbuilddate
ElseIf y = 8 Then
Forms!frmcal!rptcal8date = x
Forms!frmcal!rptCal8.Visible = True
GoTo nextbuilddate
ElseIf y = 9 Then
Forms!frmcal!rptcal9date = x
Forms!frmcal!rptCal9.Visible = True
GoTo nextbuilddate
ElseIf y = 10 Then
Forms!frmcal!rptcal10date = x
Forms!frmcal!rptCal10.Visible = True
GoTo nextbuilddate
ElseIf y = 11 Then
Forms!frmcal!rptcal11date = x
Forms!frmcal!rptCal11.Visible = True
GoTo nextbuilddate
ElseIf y = 12 Then
Forms!frmcal!rptcal12date = x
Forms!frmcal!rptCal12.Visible = True
GoTo nextbuilddate
ElseIf y = 13 Then
Forms!frmcal!rptcal13date = x
Forms!frmcal!rptCal13.Visible = True
GoTo nextbuilddate
ElseIf y = 14 Then
Forms!frmcal!rptcal14date = x
Forms!frmcal!rptCal14.Visible = True
GoTo nextbuilddate
ElseIf y = 15 Then
Forms!frmcal!rptcal15date = x
Forms!frmcal!rptCal15.Visible = True
GoTo nextbuilddate
End If
nextbuilddate:
'advance to next build-date
x = x + 1
If Weekday(x) = 7 Then x = x + 2
'move to next grid
y = y + 1
'check for no-build days
If IsNull(DLookup("[index]", "tblBuilds", "[BuildDate] = #" & x & "#") And y < 16 Then
GoTo nextbuilddate
End If
Loop
End Sub
The problems are within the DLookUp Parts. Thanks...
Private Sub Form_Load()
Dim x As Date
Dim y As Integer
'find out what next build date is based on scheduled builds
x = DMin("[BuildDate]", "tblBuilds", "[Built] = 0 and [inactive] = 0 and [location] <> ""Parts Room"""
y = Weekday(x) - 1
'check for a saturday
If y = 6 Then y = 5
'start populating
Do Until y = 16
If y = 1 Then
Forms!frmcal!rptcal1date = x
Forms!frmcal!rptCal1.Visible = True
GoTo nextbuilddate
ElseIf y = 2 Then
Forms!frmcal!rptcal2date = x
Forms!frmcal!rptCal2.Visible = True
GoTo nextbuilddate
ElseIf y = 3 Then
Forms!frmcal!rptcal3date = x
Forms!frmcal!rptCal3.Visible = True
GoTo nextbuilddate
ElseIf y = 4 Then
Forms!frmcal!rptcal4date = x
Forms!frmcal!rptCal4.Visible = True
GoTo nextbuilddate
ElseIf y = 5 Then
Forms!frmcal!rptcal5date = x
Forms!frmcal!rptCal5.Visible = True
GoTo nextbuilddate
ElseIf y = 6 Then
Forms!frmcal!rptcal6date = x
Forms!frmcal!rptCal6.Visible = True
GoTo nextbuilddate
ElseIf y = 7 Then
Forms!frmcal!rptcal7date = x
Forms!frmcal!rptCal7.Visible = True
GoTo nextbuilddate
ElseIf y = 8 Then
Forms!frmcal!rptcal8date = x
Forms!frmcal!rptCal8.Visible = True
GoTo nextbuilddate
ElseIf y = 9 Then
Forms!frmcal!rptcal9date = x
Forms!frmcal!rptCal9.Visible = True
GoTo nextbuilddate
ElseIf y = 10 Then
Forms!frmcal!rptcal10date = x
Forms!frmcal!rptCal10.Visible = True
GoTo nextbuilddate
ElseIf y = 11 Then
Forms!frmcal!rptcal11date = x
Forms!frmcal!rptCal11.Visible = True
GoTo nextbuilddate
ElseIf y = 12 Then
Forms!frmcal!rptcal12date = x
Forms!frmcal!rptCal12.Visible = True
GoTo nextbuilddate
ElseIf y = 13 Then
Forms!frmcal!rptcal13date = x
Forms!frmcal!rptCal13.Visible = True
GoTo nextbuilddate
ElseIf y = 14 Then
Forms!frmcal!rptcal14date = x
Forms!frmcal!rptCal14.Visible = True
GoTo nextbuilddate
ElseIf y = 15 Then
Forms!frmcal!rptcal15date = x
Forms!frmcal!rptCal15.Visible = True
GoTo nextbuilddate
End If
nextbuilddate:
'advance to next build-date
x = x + 1
If Weekday(x) = 7 Then x = x + 2
'move to next grid
y = y + 1
'check for no-build days
If IsNull(DLookup("[index]", "tblBuilds", "[BuildDate] = #" & x & "#") And y < 16 Then
GoTo nextbuilddate
End If
Loop
End Sub
The problems are within the DLookUp Parts. Thanks...