Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    8

    Unanswered: autofill between 2 numbers (simulated autonumber)

    Help, my code is not working.

    My goal is to take info from a form, and create multiple entries in a
    temp table.

    Basically the form has the fields <first_number>, <last_number>,
    <name>, <year>

    Just need it to create an entry for each number between the first and
    last number to create labels, then I run an SQL statement to clear the
    table for the next <name>

    please throw me some hints as to the best way to do this, I have spent several hours looking in forums and not found a way.

    thanks

    Steven

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    This is trivial and can be handled in numerous ways ... What code do you have that isn't working? In other words, let's see what you got and go from there ... Also, how would you prefer to handle this?
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Oct 2005
    Posts
    8
    Got it working, some little mistakes. Just in case someone else could use something similar here it is:

    Dim intThisNo As Integer
    Dim RS As DAO.Recordset

    Set RS = DBEngine(0)(0).OpenRecordset("temp_etiketten", dbOpenTable, dbAppendOnly)

    For intThisNo = Me.first_number To Me.last_number
    RS.AddNew
    'rs.Edit
    RS.Fields("annahmenr") = Format(amis_nr, "000") & Format(intThisNo, "00000") & Format(the_year, "00")
    RS.Fields("barcode") = Format(amis_nr, "000") & Format(intThisNo, "00000") & Format(the_year, "00")
    RS.Fields("mitarbeiter") = Me.amis_nr
    RS.Fields("jahr") = Format(the_year, "00")
    RS.Fields("name") = Me.person

    RS.Update
    Next intThisNo

    RS.Close

Posting Permissions

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