K
Krisse
I'm getting a Type Mismatch error on the statement
Set rs = db.OpenRecordset("tblTryDates", dbOpenDynaset
when running the code below.
Any Ideas?
Private Sub cmdGo_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTryDates", dbOpenDynaset)
Dim CheckEnd As Date
Dim DoDate As Date
Dim DoDateDOW As Integer
CheckEnd = CDate(Me.txtEndDate)
DoDate = CDate(Me.txtBeginDate)
While DoDate <= CheckEnd
msgbox "DateBefore " & DoDate, vbOKOnly
DoDateDOW = DatePart("w", DoDate)
If Me.Sun = -1 And DoDateDOW = 1 Or _
Me.Mon = -1 And DoDateDOW = 2 Or _
Me.Tue = -1 And DoDateDOW = 3 Or _
Me.Wed = -1 And DoDateDOW = 4 Or _
Me.Thu = -1 And DoDateDOW = 5 Or _
Me.Fri = -1 And DoDateDOW = 6 Or _
Me.Sat = -1 And DoDateDOW = 7 Then
'msgbox "DOW Match " & DoDateDOW, vbOKOnly
rs.AddNew
rs!UseDate = DoDate
rs!FacilityCode = Me!cboFacility
rs!ActivityCide = Me!cboActivityCode
rs!BegTime = Me!txtBegTime
rs!EndTime = Me!txtEndTime
rs!Basepath = Me!cboBasepath
rs.Update
End If
DoDate = DateAdd("d", 1, [DoDate]) ' Increment
DoDate.
'msgbox "DateAfter " & DoDate, vbOKOnly
Wend ' End While loop when DoDAte > CheckEnd
msgbox "All Done ", vbOKOnly
rs.Close
Set rs = Nothing
End Sub
Set rs = db.OpenRecordset("tblTryDates", dbOpenDynaset
when running the code below.
Any Ideas?
Private Sub cmdGo_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblTryDates", dbOpenDynaset)
Dim CheckEnd As Date
Dim DoDate As Date
Dim DoDateDOW As Integer
CheckEnd = CDate(Me.txtEndDate)
DoDate = CDate(Me.txtBeginDate)
While DoDate <= CheckEnd
msgbox "DateBefore " & DoDate, vbOKOnly
DoDateDOW = DatePart("w", DoDate)
If Me.Sun = -1 And DoDateDOW = 1 Or _
Me.Mon = -1 And DoDateDOW = 2 Or _
Me.Tue = -1 And DoDateDOW = 3 Or _
Me.Wed = -1 And DoDateDOW = 4 Or _
Me.Thu = -1 And DoDateDOW = 5 Or _
Me.Fri = -1 And DoDateDOW = 6 Or _
Me.Sat = -1 And DoDateDOW = 7 Then
'msgbox "DOW Match " & DoDateDOW, vbOKOnly
rs.AddNew
rs!UseDate = DoDate
rs!FacilityCode = Me!cboFacility
rs!ActivityCide = Me!cboActivityCode
rs!BegTime = Me!txtBegTime
rs!EndTime = Me!txtEndTime
rs!Basepath = Me!cboBasepath
rs.Update
End If
DoDate = DateAdd("d", 1, [DoDate]) ' Increment
DoDate.
'msgbox "DateAfter " & DoDate, vbOKOnly
Wend ' End While loop when DoDAte > CheckEnd
msgbox "All Done ", vbOKOnly
rs.Close
Set rs = Nothing
End Sub