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
"Dirk Goldgar" wrote:
> "amy14775" <(E-Mail Removed)> wrote in message
> news:7B7B366A-E449-4AF3-B91F-(E-Mail Removed)
> > I am having an error code come up saying Run Time Error '3061' Too few
> > parameters. Expected 1
> >
> > This error shows me my execute statement:
> > db.execute strSQL, dbFailOnError.
> >
> > I have defined by db as CurrentDb already. I am trying to execute my
> > Insert Into statement which is the variable strSQL.
> > Please help anyone.....
>
> You'll get that message when the SQL string contains an unresolved
> parameter, or an unrecognized word that the query engine construes as a
> parameter. Does your SQL string contain a reference to a control on a
> form? If so, DAO won't recognize it and fill it in automatically.
> Usually, your best solution to this problem is to build the value of the
> control into the string, rather than a reference to the control.
>
> What's the value of strSQL, and what does the surrounding code look
> like?
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>