Question Access Sql parameters Question

ggunter

Well-known member
Joined
Apr 23, 2008
Messages
137
Programming Experience
Beginner
Please forgive my ignorance. I'm from a VB6 background and new to Parameterized Queries.

I thought the PQ's were supposed to be
VB.NET:
INSERT INTO tblAssoc ( ?, ? ) VALUES (@name, @name)

But when I try to run that I get a syntax error. If I replace the ? with the actual field name it runs. What am I not understanding?:confused:

FYI, this was being used in an INSERT query.
 
You'll need the field names.

I seem to remember that it's the values that Access has trouble with - you cant "name" the parameters, you just have to supply them in the order that they are in the PQ (I think - check this yourself)
 
Got it!!:)

My problem was in supplying the field names at all. It should have been
VB.NET:
INSERT INTO tblAssoc VALUES (@acid, @first, @last, @mgr, @bucket, @dept)

Not
VB.NET:
INSERT INTO tblAssoc ( Acid, FirstName, LastName, MgrFull, Bucket, Department ) & _
VALUES (@acid, @first, @last, @mgr, @bucket, @dept)

Thanks!!:D
 
Back
Top