function Error

N

Nylex

I am close to finishing and have I hope one last error

The following returns an error

strSQL = "INSERT INTO
WorkOrder(Property,PONo,Workdate,totalamt,wknotes,invno,status)" &
"VALUES(CProp,CPO,invdate,curamt,curnotes,nextinv,curstatus)"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded

Run Time Error 3061
Too few Parameters. Expected 7

I count seven in each section
 
S

Stefan Hoffmann

hi,
The following returns an error
strSQL = "INSERT INTO
WorkOrder(Property,PONo,Workdate,totalamt,wknotes,invno,status)" &
"VALUES(CProp,CPO,invdate,curamt,curnotes,nextinv,curstatus)"
CurrentDb.Execute strSQL, dbFailOnError
Response = acDataErrAdded
There is a space missing before "VALUES..".


mfG
--> stefan <--
 
D

Douglas J. Steele

Assuming that CProp, CPO, invdate, curamt, curnote, nextinv and curstatus
are variables, you have to put them outside of the quotes so that their
values will be put into strSQL:

strSQL = "INSERT INTO
WorkOrder(Property,PONo,Workdate,totalamt,wknotes,invno,status) " &
"VALUES(" & CProp & ", '" & CPO & "', " & Format(invdate,
"\#yyyy\-mm\-dd\#") & ", " & curamt & ", """ & curnotes & """, '" & nextinv
& "', '" & curstatus & "')"

I've assumed Property is a numeric value, so there are no quotes being added
to the string around the value. Note that I put three double quotes in a row
(which translates to putting a single double quote in the string) around
curnotes, just in case there's an apostrophe in what's in the text. For the
other fields, I put single quotes. Note the Format statement around the date
so that has the # delimiters Access requires for dates, and it's in a format
Access is guaranteed to recognize.
 
N

Nylex

it appears nearly fixed

It errors as follows
Run time Error 3075
Syntax error in Query expression 'Clean all outside windows'

the table has wknotes set as text and curnotes is set as a string

the wording "Clean all etc" is what is on the schedule list so is the
correct answers to put into the workorder table
 
N

Nylex

Have been studying your reply and my entries and I w3as missing a !
Have now entered and it works fine
Tks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top