I am having a hard time with writing a statement that will automatically insert a new date (30 days out) and forcast ID. I have tried an insert statement and update statement, but none of them will work.
This section is part of the module I am trying to build. Can anyone see an error in this section? Should the str go elsewhere?
Set rsDistinctForcasts = mydb.OpenRecordset("QRY_DISTINCT_FORCAST_IDS"
With rsDistinctForcasts
If Not .EOF Then
Do Until .EOF
strSQL = "SELECT MAX(FORCAST_OT_DATE) AS MAX_DATE FROM TBL_FORCASTS_OT_DATES WHERE FORCAST_ID = " & !ForcastID
Set rsMaxDate = mydb.OpenRecordset(strSQL)
datMaxDate = rsMaxDate!MAX_DATE
lngDateDiff = DateDiff("d", datMaxDate, datCurrDate)
For i = 0 To lngDateDiff
strSQL = "Tried insert and update here "
Next
.MoveNext
Loop
End If
End With
This section is part of the module I am trying to build. Can anyone see an error in this section? Should the str go elsewhere?
Set rsDistinctForcasts = mydb.OpenRecordset("QRY_DISTINCT_FORCAST_IDS"
With rsDistinctForcasts
If Not .EOF Then
Do Until .EOF
strSQL = "SELECT MAX(FORCAST_OT_DATE) AS MAX_DATE FROM TBL_FORCASTS_OT_DATES WHERE FORCAST_ID = " & !ForcastID
Set rsMaxDate = mydb.OpenRecordset(strSQL)
datMaxDate = rsMaxDate!MAX_DATE
lngDateDiff = DateDiff("d", datMaxDate, datCurrDate)
For i = 0 To lngDateDiff
strSQL = "Tried insert and update here "
Next
.MoveNext
Loop
End If
End With