PDA

Click to See Complete Forum and Search --> : Running a Query


parkes
Jul 29th, 1999, 02:59 PM
I'm using VB6 and Access 97.
I want to run an Append query using VB.
I've got a Query called Transfer which has a parameter called Refno.

I want to be able to send the reference from VB into this query. Which will hopefully run this query and update another table. Could anyone please give me some help?

------------------
Thanks in advance for any help provided.

Michael
Jul 29th, 1999, 04:15 PM
Hi parkes, try this:

Dim qdf As QueryDef
On Error GoTo ErrorHandler
Set qdf = dbData.QueryDefs("Transfer")
qdf.Parameters("Refno").Value = <ValueOfRefno>
qdf.Execute dbFailOnError
...
ErrorHandler
...

where dbData is your (opened) database object.

Hope this is of some use


[This message has been edited by Michael (edited 07-30-1999).]

parkes
Jul 29th, 1999, 06:02 PM
Thanks for that, it work. But how do you do the same thing using ADO.


------------------
Thanks in advance for any help provided.

Michael
Jul 29th, 1999, 06:07 PM
Thats a good question! I'm still trying to get to grips with ADO myself. My company has decided that we will stick with DAO for the time being so I am not so familiar with ADO as I would like to be! I'm trying to learn it in my spare(?) time.