Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conversion from MS ACCESS 2003 to 2007 INSERT NOT WORKING

Status
Not open for further replies.

Sillygirl

Programmer
May 3, 2002
80
US
I am converting a MS ACCESS 2003 DB to MS ACCESS 2007, within the loop below, I'm setting holddate to a date the user selects. I am then counting up to a week within the loop. Meanwhile I'm taking that same date (holdDate) and extracting the day and inputting the values in a table. It works perfectly fine in Access 2003, but not in 2007. Can anyone please tell me what is wrong and where is the difference? Thanks.

Do While intReportDays < 7
'is hold date a weekend day
If (DatePart("w", [holdDate]) = 1) Then
holdDate = DateAdd("y", 1, holdDate) 'Add one day to holddate
Else 'is hold date a holiday
Set Myset = MyDB.OpenRecordset("tblHoliday", DB_OPEN_DYNASET)
Criteria = "HOLIDAY_DATE = #" & holdDate & "#"
Myset.FindFirst Criteria
If Myset.NoMatch Then 'Date is a working day
' write hold date to table
strDateDesc = Format$([holdDate], "dddd")
strholddate = Format$([holdDate], "mm/dd/yyyy")
Set Myset = MyDB.OpenRecordset("tblRptDates")
DoCmd.RunSQL "INSERT INTO tblRptDates(INDIVIDUAL_DATE,INDIVIDUAL_DAY,str_Individual_date) VALUES([holdDate],[strDateDesc],[strholddate]);"
holdDate = DateAdd("y", 1, [holdDate]) 'Add one day to holddate
intReportDays = intReportDays + 1 'Add one to counter
Else
holdDate = DateAdd("y", 1, holdDate) 'Add one day to holddate
End If
End If
Loop
 
SOLVED!!

DoCmd.RunSQL "INSERT INTO tblRptDates(INDIVIDUAL_DATE,INDIVIDUAL_DAY,str_Individual_date) VALUES('" & holdDate & "','" & strDateDesc & "','" & strholddate & "');"


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top