ozdemirozgur
Registered User.
- Local time
- Today, 23:17
- Joined
- Apr 29, 2011
- Messages
- 47
I have the following code which moves records from one table to another one based on a if condiction. However, my isnert statement does not work and when I run the code it is aksing for the value of the fields which is supposed to come from the do while selected record on the first table.
please help.
ozgur
Dim StrSQL As String
Set myDB = CurrentDb()
Set Rem10_2000_Combined = myDB.OpenRecordset("Rem10_2000_Combined", dbOpenTable)
Set Rem10_2000_Combined_Annualized = myDB.OpenRecordset("Rem10_2000_Combined_Annualized", dbOpenTable)
Do While Not Rem10_2000_Combined.EOF
If Rem10_2000_Combined!PERIOD_END = #12/31/1999# Or Rem10_2000_Combined!PERIOD_END = #12/31/2000# Or Rem10_2000_Combined!PERIOD_END = #12/31/2010# Then
DoCmd.RunSQL "INSERT INTO Rem10_2000_Combined_Annualized (Hems_year, Rem_Year, COY_ID) values (REM10_2000_COMBINED!Hems_Year , REM10_2000_COMBINED!Rem_Year, REM10_2000_COMBINED!COY_ID)"
End If
Rem10_2000_Combined.MoveNext
Loop
please help.
ozgur
Dim StrSQL As String
Set myDB = CurrentDb()
Set Rem10_2000_Combined = myDB.OpenRecordset("Rem10_2000_Combined", dbOpenTable)
Set Rem10_2000_Combined_Annualized = myDB.OpenRecordset("Rem10_2000_Combined_Annualized", dbOpenTable)
Do While Not Rem10_2000_Combined.EOF
If Rem10_2000_Combined!PERIOD_END = #12/31/1999# Or Rem10_2000_Combined!PERIOD_END = #12/31/2000# Or Rem10_2000_Combined!PERIOD_END = #12/31/2010# Then
DoCmd.RunSQL "INSERT INTO Rem10_2000_Combined_Annualized (Hems_year, Rem_Year, COY_ID) values (REM10_2000_COMBINED!Hems_Year , REM10_2000_COMBINED!Rem_Year, REM10_2000_COMBINED!COY_ID)"
End If
Rem10_2000_Combined.MoveNext
Loop