amy14775 said:
Dirk,
This is the code for the calculation button. I am trying to populate
a table with records that are calculated from this code. Basically it
will loop through and give me 12 dates in the future that will be
seperate records in my other table. The string is my Insert Into
code. The values in the code will partly be what the user enters on
the form and part what the code calculates for the dates needed in
the future. But like I said previously, I keep getting the parameter
message. Any help you can give would be so greatly appreciated. It is
one of those I had to get up for a little while and walk away. So a
fresh set of eyes would be most helpful.
Thank you,
Amy
Private Sub cmdCalcWeek_Click()
Dim db As DAO.Database
Dim intCounter As Integer
Dim dteTest As Date
Dim dteStart As Date
Dim strSql As String
Set db = CurrentDb
dteStart = Me.txtStart
For intCounter = 1 To 12 Step 1
dteTest = DateAdd("d", 7, dteStart)
strSql = "Insert Into
Test(SocialSecurity,StartDate,TestType,DateDue)" & "Values('" &
Me.txtSocialSecurity & "', #" & Me.txtStart & "#, " & Me.lstTestType
& ", #" & dteTest & "#)"
db.Execute strSql, [dbFailOnError]
dteStart = dteTest
Next intCounter
Set db = Nothing
Make sure that "Test" is really the name of your table, and that
"SocialSecurity", "StartDate", "TestType", and "DateDue" are really the
names of fields in that table -- check the exact spellings. Also, check
that TestType is a numeric field, and that the bound column of
lstTestType contains numeric values.
If I were writing this, I'd put a space into the SQL string before the
"Values" keyword for clarity, but that isn't actually required in this
case because the closing parenthesis is a sufficient delimiter.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)