Solved

DAO Recordset Select Statement

Posted on 2006-11-14
1
751 Views
Last Modified: 2008-01-09
Hi,

Can anyone tell me or point me to the VBA which I can

a)Create a recordset (Dim ThisRecordset As DAO.Recordset)

b)Fill this record set using a specific Sql Statement ("SELECT * FROM MyTable WHERE FieldA = 1")

Thanks in advance

Andrew
0
Comment
Question by:REA_ANDREW
[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
1 Comment
 
LVL 1

Accepted Solution

by:
jkanisut earned 500 total points
ID: 17939330
Dim db As DAO.Database
Set db = OpenDatabase(sDBPath, False, False, "ODBC;SERVER=Server;UID=user;PWD=password;DSN=ODBCentry)

Dim sSql as string
sSql = "SELECT * FROM MyTable WHERE FieldA = 1"

Dim rs As DAO.Recordset
Set rs = db.OpenRecordset(sSql, dbOpenSnapshot)

Do While rs.EOF
data = rsFields("fieldname")
rs.MoveNext
Loop

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TT Auto Dashboard 13 101
vbModal 12 66
VB6 - Scroll Mouse wheel on Picturebox 13 95
transition to visual .net from vb6 5 61
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 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