Results 1 to 3 of 3

Thread: Access 2003 VBA

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    107

    Access 2003 VBA

    Can someone please help me with a simple question -
    I'm using a DAO connection in an Access database. I want to simply add some new records that are coming in from a table. I'm using the following commands:

    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Set db = CurrentDb()
    Dim str As String
    str = "select * from Mytable" - I don't think this is necessary????
    Set rs = db.OpenRecordset(str) ?????
    With rs
    .AddNew
    !batch = PTbl
    !Item = PSrCnt
    .Update

    End With

    I just want to add records to a table. Mytable has thousands of records and this routine is taking 30 seconds to add 4 records. I don't need to select all the records in Mytable but I don't know what code to use. Thank you.

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Access 2003 VBA

    MAB
    You would be much better served by using an ADO connection and passing your inserts into a command object
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    107

    Re: Access 2003 VBA

    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width