Append queries...

H

h3llz

INSERT INTO tblProductsLog ( staffID, productID, [timestamp], quantity )
VALUES ([staffID], [productID], now(), -[quantity]);

i got that in a query, but when i use DoCmd.OpenQuery it asks me for
variables which is already set before i execute it, therefore i need to do
the query some other way? please help :<
 
S

Stefan Hoffmann

hi,
INSERT INTO tblProductsLog ( staffID, productID, [timestamp], quantity )
VALUES ([staffID], [productID], now(), -[quantity]);

i got that in a query, but when i use DoCmd.OpenQuery it asks me for
variables which is already set before i execute it, therefore i need to do
the query some other way? please help :<
You cannot set parameters for query when using DoCmd.OpenQuery. You need
to use a QueryDef object for that, e.g. something like that:

Dim qd As DAO.QueryDef

Set qd = CurrentDb.QueryDefs.Item("nameOfYourQuery")
qd.Parameters.Item(<NameOrIndex>).Value = <yourValue>
qd.Execute
Set qd = Nothing


mfG
--> stefan <--
 

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

Top