MatMac
03-25-2008, 09:07 AM
Hi
I would like to add the value stored in a variable "yearpointer" into a table using an append query.
Probably something straightforward, but in the code below, "yearpointer" can't be found. (All other variables have been defined, although omitted here.)
Any idea what I am doing wrong? Thanks.
Private Sub processCosting()
Dim yearpointer As Integer
yearpointer = 1
Do While (yearpointer < acLast)
DoCmd.RunSQL "INSERT INTO costing ( projID, acYear, element, amount ) Values (001 , yearpointer, 'COST', 20)"
yearpointer = yearpointer + 1
Loop
End Sub
I would like to add the value stored in a variable "yearpointer" into a table using an append query.
Probably something straightforward, but in the code below, "yearpointer" can't be found. (All other variables have been defined, although omitted here.)
Any idea what I am doing wrong? Thanks.
Private Sub processCosting()
Dim yearpointer As Integer
yearpointer = 1
Do While (yearpointer < acLast)
DoCmd.RunSQL "INSERT INTO costing ( projID, acYear, element, amount ) Values (001 , yearpointer, 'COST', 20)"
yearpointer = yearpointer + 1
Loop
End Sub