How to execute a query in VB.

  • Thread starter Thread starter ket_shah
  • Start date Start date
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.
 
A query can be used as the source for a subsequent operation. All
underlying queries for an operation are run implicitely.
 
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
 
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
 
Back
Top