Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    103

    Unanswered: Append table fields with a series using for/next

    I would like to set up an event that updates a table with document numbers in a range plus a few static fields. The approach is this, The user opens a form, and selects from a list box the ID of someone to whom numbered "hardcopy" documents are issued. The user then inputs the range of document numbers, then clicks on a button that runs the event to:

    Private Sub ISSUE_FSRS_Click()

    DoCmd.OpenForm "FSR LOG", , acAdd //the name of a form or table (I have tried both)
    For Index = [first fsr number] To [last fsr number] //get a series of numbered documents
    fsr_number = Index //assign the index number to the document
    DoCmd.GoToRecord , , acNewRec //is this what I should to here???
    ___________________ // need command for putting the data into the table or onto the form
    ___________________ // I assume same command would be used for each of the other fields, though they are static.
    Next
    DoCmd.Close "FSR LOG"

    End Sub

    I would use an append query, except I don't know how I'd increment the document number; I can't use an autonumber because the documents are prenumbered, and books may be issued out of sequence etc.

    I know this is pretty basic, but I just don't quite see how to do it.
    Last edited by jdostie; 10-09-03 at 18:39.

  2. #2
    Join Date
    Apr 2003
    Location
    Homer, Alaska
    Posts
    15
    How does the user input the range of document numbers?

  3. #3
    Join Date
    Oct 2003
    Posts
    103
    Originally posted by tsulczynski
    How does the user input the range of document numbers?
    I'M sorry, I put l put fields on the form (not linked to a table) that are referenced in the for next loop [first fsr] and [last fsr]

  4. #4
    Join Date
    Oct 2003
    Location
    Roanoke, Va
    Posts
    445

    Smile Re: Append table fields with a series using for/next

    Originally posted by jdostie
    I would like to set up an event that updates a table with document numbers in a range plus a few static fields. The approach is this, The user opens a form, and selects from a list box the ID of someone to whom numbered "hardcopy" documents are issued. The user then inputs the range of document numbers, then clicks on a button that runs the event to:

    Private Sub ISSUE_FSRS_Click()

    DoCmd.OpenForm "FSR LOG", , acAdd //the name of a form or table (I have tried both)
    For Index = [first fsr number] To [last fsr number] //get a series of numbered documents
    fsr_number = Index //assign the index number to the document
    DoCmd.GoToRecord , , acNewRec //is this what I should to here???
    ___________________ // need command for putting the data into the table or onto the form
    ___________________ // I assume same command would be used for each of the other fields, though they are static.
    Next
    DoCmd.Close "FSR LOG"

    End Sub

    I would use an append query, except I don't know how I'd increment the document number; I can't use an autonumber because the documents are prenumbered, and books may be issued out of sequence etc.

    I know this is pretty basic, but I just don't quite see how to do it.

    Whenever I want to add records to a table I usually open a recordset on

    table and then .Edit or .AddNew depending on what is needed. Loop

    through the input values and add each one to the table.

    May not be what you're looking for but maybe it will help light off some

    brain cells and get you on track.

    Good Luck,

    Gregg

    cells

Posting Permissions

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