Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Running Queries made in ACCESS

Posted on 1998-10-04
3
Medium Priority
?
118 Views
Last Modified: 2010-04-30
Is it possible to run queries defined in ACCESS using VB 5.0? If it is, how can it be done?  If not, what is a good alternative?
0
Comment
Question by:wsanchez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:MelissaC
ID: 1438127
With ADO, I thought it was

dim conn as ADODB.Connection
dim rs as ADODB.Recordset
dim sql as string
sql="put your queryname here"

conn.Open DSN, ...
rs.open sql conn,1,3
0
 
LVL 5

Accepted Solution

by:
chewhoung earned 100 total points
ID: 1438128
Yes you can.

To run a query in access from vb, first you must open the database.

    Set MyDB = OpenDatabase("C:\Yourdatabase.mdb")

To execute an append/update/delete query, use the execute method:

    MyDB.Execute "Your Query Name"

To retrieve data from a query, use openrecordset method:

    Set rstRecordset = MyDB.OpenRecordset("Your Query Name", dbOpenDynaset)

    With rstRecordset
         ...do something
         ...do something
    End With

    rstRecordset.close
0
 

Author Comment

by:wsanchez
ID: 1438129
I'll try that out.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question