How to execute a query in VB.

K

ket_shah

Can I execute a query similar to a cursor in Oracle (Open cursor,Fetch
data and Close Cursor).

I want to execute a query
Don't want to view the data.
But than fetch the data from the query.

??

Thanks in advance.
 
S

Sirocco

A query can be used as the source for a subsequent operation. All
underlying queries for an operation are run implicitely.
 
D

Dan Artuso

Hi,
It sounds like you want to open a recordset from your query.

Dim dbs As Database, rst As Recordset
Dim strSQL As String

' Return reference to current database.
Set dbs = CurrentDb
strSQL = "SELECT * FROM Orders WHERE [ShipCountry] = 'UK'"
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveLast
Debug.Print rst.RecordCount
rst.Close
Set dbs = Nothing
 
K

Kamy_s

When I click a button which is on the form.

I want to execute the query, than fetch the data and insert those dat
into another tables.

I have written an append query which does insert to other table.

How can I execute the query created so that that data will be inserte
into the other table.

Please advise
 

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