Solved

Write only dao recordset

Posted on 2001-07-29
5
317 Views
Last Modified: 2012-08-13
I have a dao recordset with over 100 thousand records in it.  I don't need to read or edit these records in my recordset I only wish to add new records.  I think a lot of time is wasted when I run this recordset because it loads so many records.

How can I initiate my recordset so that it loads no records?
0
Comment
Question by:billy21
  • 3
  • 2
5 Comments
 
LVL 6

Author Comment

by:billy21
Comment Utility
I tried using dbappendonly but it for some reason wont let me add new records using .addnew
0
 
LVL 12

Accepted Solution

by:
Paurths earned 100 total points
Comment Utility
hi

did u use the correct syntax?
using only 'dbAppendOnly' wont work. U have to use it in combination wit a cursor.

Dim rst As DAO.Recordset
Dim db As DAO.Database
Dim strsql As String

    strsql = "select * from YourTable;"
    Set db = CurrentDb
    Set rst = db.OpenRecordset(strsql, dbOpenDynaset, dbAppendOnly)
   
      rst.AddNew
      rst![SomeField] = "Hello There"
      rst.Update

    rst.Close
    Set rst = Nothing
    db.Close
    Set db = Nothing



cheers
Ricky
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
this will only load the tablestructure and no records
--> u can try it by moving to the first record and displaying it - it wont work.

So u can only append data to it.

cheers
Ricky
0
 
LVL 6

Author Comment

by:billy21
Comment Utility
Worked like a charm.

Thanks
0
 
LVL 12

Expert Comment

by:Paurths
Comment Utility
strange,
i only received email-notif 10 minutes ago...

thanx for the 'A'-grade, billy21,

c u later,
Ricky
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now