Results 1 to 4 of 4

Thread: append

  1. #1
    Join Date
    Jun 2002
    Location
    uae
    Posts
    3

    Post Unanswered: append

    how to append 1 record to a table 1000 times , (some other way than using run macro repeat function)

  2. #2
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Do you want to do it or have a user do it?

    One way to do it yourself is copy the record to excel, then copy it there a thousand times. Once finished, copy it back in the table.

    Or within Access, copy the record (ctrl c), paste it ten times(ctrl v).
    Then copy those ten records (highlight all ten, ctrl c), then paste it ten times(ctrl v). Then copy those hundred records (highlight 100, ctrl c), then paste it ten times(ctrl v). This tedious task would take about 1 minute.

    Or, if you need to provide a means for the user to do it, perhaps you will have to write code. What is your goal?
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  3. #3
    Join Date
    Jun 2002
    Location
    uae
    Posts
    3

    Re: append

    Originally posted by kamran
    how to append 1 record to a table 1000 times , (some other way than using run macro repeat function) yes this is required for the end user, so any code to help me automate this..pls.

  4. #4
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    This sample is based on a table called "tblTrial."
    The table, tblTrial, has three fields, TrialText, TrialNumber, TrialDate. On the form there is a command button that calls the code below.

    Private Sub cmdCopy1000_Click()
    Dim db As Database[/blockquote]
    Dim rs As Recordset
    Dim intI As Integer

    Me.Refresh
    Set db = CurrentDb
    Set rs = db.OpenRecordset("tblTrial")
    For intI = 1 To 1000
    rs.AddNew
    rs!TrialText = Me.txtTrialText
    rs!TrialDate = Me.txtTrialDate
    rs!TrialNumber = Me.txtTrialNumber
    rs.Update
    Next intI
    rs.Close
    db.Close
    End Sub

    Hope this helps
    Last edited by jpshay; 07-10-02 at 18:17.
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

Posting Permissions

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