Solved

DAO Recordset Select Statement

Posted on 2006-11-14
1
752 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
clicking a shape in a frame array vb6 3 54
Problem to With line 4 85
Set email body to html using vbscript 6 89
Fastest way to find and count same items VB6 16 62
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

738 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