Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Append queries...

Geek News

Append queries...
h3llz 12/4/2008 11:43:01 AM
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 :<
Re: Append queries...
Stefan Hoffmann <ste5an[ at ]ste5an.de> 12/4/2008 1:29:43 PM
hi,

h3llz wrote:
[Quoted Text]
> 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 <--

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net