Results 1 to 4 of 4

Thread: Label Numbering

  1. #1
    Join Date
    May 2012
    Posts
    2

    Question Unanswered: Label Numbering

    I want to create a label that increments by a set amount.

    I'm starting from a form that has a dataset with three fields: Start, Stop and Interval. I want to be able to have more than one set of entries. Something like this:

    Start Stop Interval
    1000 2000 10
    2005 3000 5

    I want to create labels that begin at the Start value (1000) and increment by the Interval value for that record. 1000, 1010, 1020 and so on until it reached the Stop value of 2000. Then continue from the new Start value in increments of the next Interval value. 2005, 2010, 2015....

    A point in the right direction would be very helpful.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what do you propose to do with this 'label'
    is it stored, where is it used
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,418
    Provided Answers: 7
    What I would do is create a temp table "labels"
    Write some code

    OFF TOP OF HEAD

    Sub makelabels(lbstart,lbstop,lint)
    Dim rs as records eat
    Dim db as database
    Set db = currentdb
    Rs = db.openrecordset("labels")
    For labelnu = lbstart to lbstop step lint
    Rs.new
    Rs(feildname)=labelnu
    Rs.update
    Next
    Rs.close()
    Set rs = nothing
    Set db = nothing
    End sub

    Done
    Now you print the labels

    Don't forget to delete the data before you run it LOL
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  4. #4
    Join Date
    May 2012
    Posts
    2

    Label Numbering

    What I want to do is populate a temporary table with data, print labels from it and them delete it. So far I'm pretty clear on creating the table called tblVial Depth. Here's the code I'm using:

    ' Check if the table already exists. If it does delete it.
    If fExistTable("tblVialDepth") Then
    DoCmd.DeleteObject acTable, "tblVialDepth"
    End If
    ' Create table with one field "Depth"
    Dim dbs As Database
    Dim tdf As TableDef, fld As Field

    Set dbs = CurrentDb
    Set tdf = dbs.CreateTableDef("tblVialDepth")
    Set fld = tdf.CreateField("Depth", dbSingle, 8)
    tdf.Fields.Append fld
    dbs.TableDefs.Append tdf


    I'll delete the temporary table as I exit the form. No problems with this part.

    I have a command button Print Vial Labels. When I run the command, I'll create the temporary table. I now want to populate this table with data as described. I guess what I need to do is insert new records that fit between the parameters given i.e. Start, Stop and Interval.

    The code described by myle seems to point in the right direction but I'm not quite there yet.

    The dataset that I want it to look at is based on a query that gives me the intervals for a specific oil well sample. The printed vial labels will end up with the well name and a depth.

    I appreciate your input.

Posting Permissions

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