I get an error in the line with the alter table command. I'm trying to create a field for each month based on the variable monthly using a loop, however it is not going through since I don't get the desired result. The code creates a column called monthly and then gives an error on the second iteration. Code is as follows:
Dim x As Integer
Dim Months As Integer
Dim monthly As String
Months = Me.YearsBack * 12
Set db = CurrentDb
If Me.Period = "monthly" Then
For x = 1 To 2
'Months
monthly = "WP M" & x
db.Execute "ALTER TABLE tblEPdata ADD COLUMN [monthly] string;"
Next
End If