Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

First time writing recordset...Need Help Please

Status
Not open for further replies.

pewilson

Technical User
Mar 9, 2001
52
US
I want to begin creating and writing my own recordset code in Access 97, but I want to know which should I use... ADO or DAO and does anyone have a sample recordset or sample database I can use as a learning tool? All suggestions will be greatly taken as a helping hand.

Thanks in Advance,

Paul
paul_wilson74@hotmail.com
 
I use DAO. With ADO using I had some problems when I tried to implement several things of Access 97 DB.

Aivars
 
Do you have examples I can use as examples?
 
This is the code I use to access Recordsets and I haven't had any problems using either Access 97 or Access 2000:

Dim Dbs as Database, Rst as Recordset
Dim Ctr,Ttl as Long
Ctr = 0
Set Dbs = CurrentDb
Set Rst = Dbs.OpenRecordset("Name of Table/Query",dbOpenDynaset)
DoCmd.OpenForm "StatusBox"

*** Note: if you're just looking at the information and not changing/adding - I use "dbOpenSnapshot" instead of dbOpenDynaset

Rst.MoveLast
Rst.MoveFirst ' Populates Recordset
Ttl = Rst.RecordCount ' Can only count after populating
Do While Not Rst.EOF ' EOF = End of File
Ctr = Ctr + 1
Forms!StatusBox!Status.Caption = "Processing Record " & Ctr & " of " & Ttl
DoEvents ' DoEvents makes sure the form updates and shows the user the count
Select Case UsersChoice
Case 1 ' Option to Delete Record
Rst.Delete
Case 2 ' Option to Modify Record
Rst.Edit
Rst!Name = "UserGivenName"
Rst!Status = "UserGivenStatus"
Rst.Update
Case 3 ' Option to Add Record
Rst.AddNew
Rst!Name = "UserGivenName"
Rst!Status = "UserGivenStatus"
Rst.Update
End Select
Rst.MoveNext
Loop
Rst.Close

Hope this helps,

Roy (aka BanditLV)
Las Vegas
For further information, you can contact me at RLMBandit@aol.com
 
I am trying to do the same thing, but when I try to execute the line:

Dim db as database

VBA doesn't know what 'database' is. Do I need to turn a certain reference on so VBA knows what I'm taying about?

Thanks!
 
Reference to DAO (C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll)!!!

Aivars
 
I am having the same problem as striker73 and have tried referencing to (C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll), but the file doesn't exist despite me installing all the Access components available in Office 2000.
Is there another way round this problem, or is there anywhere to download the file from?

Ben Cooper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top