Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

DAO Beginner Question

 
   Database Forums (Home) -> Visual Basic -> DAO RSS
Next:  List of database and Table Properties in Oracle  
Author Message
John Buffum

External


Since: Feb 01, 2007
Posts: 3



(Msg. 1) Posted: Thu Feb 01, 2007 2:23 pm
Post subject: DAO Beginner Question
Archived from groups: microsoft>public>vb>database>dao (more info?)

I need to have a program I am writing in Visual Basic 6.0 define a "cursor"
(sorry for using Oracle terms.) then open a database, open a table, read a
few records, and then close the table and database. The MSDN Library is a
little confusing, and my VB 6.0 in 21 Days book isn't helpful, either.

Anyone point me to a piece of code? That would really help.

 >> Stay informed about: DAO Beginner Question 
Back to top
Login to vote
Douglas J. Steele

External


Since: Mar 14, 2004
Posts: 716



(Msg. 2) Posted: Thu Feb 01, 2007 5:44 pm
Post subject: Re: DAO Beginner Question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Dim dbCurr As DAO.Database
Dim rsCurr As DAO.Recordset
Dim strSQL As String

strSQL = "SELECT Field1, Field2, Field3 " & _
"FROM MyTable " & _
"ORDER BY Field1"

Set dbCurr = OpenDatabase("E:\Folder\File.mdb")
Set rsCurr = dbCurr.OpenRecordset(strSQL)

Do Until rsCurr.EOF
Debug.Print rsCurr!Field1
rsCurr.MoveNext
Loop

rsCurr.Close
Set rsCurr = Nothing
dbCurr.Close
Set dbCurr = Nothing

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"John Buffum" wrote in message

>I need to have a program I am writing in Visual Basic 6.0 define a "cursor"
> (sorry for using Oracle terms.) then open a database, open a table, read a
> few records, and then close the table and database. The MSDN Library is a
> little confusing, and my VB 6.0 in 21 Days book isn't helpful, either.
>
> Anyone point me to a piece of code? That would really help.

 >> Stay informed about: DAO Beginner Question 
Back to top
Login to vote
John Buffum

External


Since: Feb 01, 2007
Posts: 3



(Msg. 3) Posted: Sun Feb 04, 2007 3:47 pm
Post subject: Re: DAO Beginner Question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thank you for the come-back.

I must be doing something wrong, here. I copied your snippet into Visual
Basic 6, and modified the lines that were table specific. It would not run.
I tried to invoke the mini-wizard by typing DAO period, hoping to see a
listbox with methods under the object DAO, but none came up. Is there
something I am expected to install that I haven't installed, yet? I get the
message, "User Defined Type not defined." I tried it without DAO, and got
the same message. "Database" and "DAO" are not defined in my system.

Is there something in the Add-In manager that I need to install?

This is why I asked the question. Stuff I am reading just isn't working.

"Douglas J. Steele" wrote:

> Dim dbCurr As DAO.Database
> Dim rsCurr As DAO.Recordset
> Dim strSQL As String
>
> strSQL = "SELECT Field1, Field2, Field3 " & _
> "FROM MyTable " & _
> "ORDER BY Field1"
>
> Set dbCurr = OpenDatabase("E:\Folder\File.mdb")
> Set rsCurr = dbCurr.OpenRecordset(strSQL)
>
> Do Until rsCurr.EOF
> Debug.Print rsCurr!Field1
> rsCurr.MoveNext
> Loop
>
> rsCurr.Close
> Set rsCurr = Nothing
> dbCurr.Close
> Set dbCurr = Nothing
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "John Buffum" wrote in message
>
> >I need to have a program I am writing in Visual Basic 6.0 define a "cursor"
> > (sorry for using Oracle terms.) then open a database, open a table, read a
> > few records, and then close the table and database. The MSDN Library is a
> > little confusing, and my VB 6.0 in 21 Days book isn't helpful, either.
> >
> > Anyone point me to a piece of code? That would really help.
>
>
>
 >> Stay informed about: DAO Beginner Question 
Back to top
Login to vote
Michael Cole

External


Since: Jun 14, 2006
Posts: 18



(Msg. 4) Posted: Mon Feb 05, 2007 6:01 am
Post subject: Re: DAO Beginner Question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

John Buffum wrote:
> Thank you for the come-back.
>
> I must be doing something wrong, here. I copied your snippet into
> Visual Basic 6, and modified the lines that were table specific. It
> would not run. I tried to invoke the mini-wizard by typing DAO
> period, hoping to see a listbox with methods under the object DAO,
> but none came up. Is there something I am expected to install that I
> haven't installed, yet? I get the message, "User Defined Type not
> defined." I tried it without DAO, and got the same message.
> "Database" and "DAO" are not defined in my system.

Project/References/Microsoft DAO 3.6 Object Library

Tick the box and click OK.


--
Regards,

Michael Cole
 >> Stay informed about: DAO Beginner Question 
Back to top
Login to vote
John Buffum

External


Since: Feb 01, 2007
Posts: 3



(Msg. 5) Posted: Mon Feb 05, 2007 12:45 pm
Post subject: Re: DAO Beginner Question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

YES! That did'r. Now to work out some minor details.
Thank you.

------------

"Michael Cole" wrote:

John Buffum wrote:
Thank you for the come-back.

I must be doing something wrong, here. I copied your snippet into
Visual Basic 6, and modified the lines that were table specific. It
would not run. I tried to invoke the mini-wizard by typing DAO
period, hoping to see a listbox with methods under the object DAO,
but none came up. Is there something I am expected to install that I
haven't installed, yet? I get the message, "User Defined Type not
defined." I tried it without DAO, and got the same message.
"Database" and "DAO" are not defined in my system.

Project/References/Microsoft DAO 3.6 Object Library

Tick the box and click OK.


--
Regards,

Michael Cole
 >> Stay informed about: DAO Beginner Question 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Looping through Records question - Hi all, I have a table in access (tbl_ReportList) that has four fields (ID, Emailto, CC, and RptName). The email and CC fields both have e-mail addresses in them and the RptName field is a list of reports in the database. For now I only have three:..

strange! vb6+access2002 - I have a mdb called treesy.mdb.There is a table,named transcipt with three fields:serial_no, eng,sound serial_no:1-10 (10 numbers) eng: 1.The movie has been on for 15 minutes, madam.@ 2.Oh, my god!@ It's 7:45 now!@ 3.Is Helen coming?@ It¡¯s 6:50 now.@..

Authentication Error??? - Ok so heres the code.. for some reason I kept getting the no permissions message, so I attempted to add the access workgroup file. Now I get the "Authentication Failed" message. This is a secure database. HELP.. I know I'm writing (adding) som...

Database Access Crashes on Windows 2003 Terminal Server - I have been running a Microsoft Access 97 application on Windows 2003 Terminal Server for almost a year now, with no problems. About two weeks ago, I started to get the following errors in my event log: Application Error; EventID: 1000 Faulting..

Software Engineers required for USA - Dear Sir, Kraftware Inc. Software Engineers required for USA We are a leading software consulting company based in Nebraska (Omaha) Growing in business for the past 9 yrs. We are currently Experiencing Growth and we are Hiring Software Engineers for..
   Database Forums (Home) -> Visual Basic -> DAO All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]