Results 1 to 5 of 5

Thread: Making Lables

  1. #1
    Join Date
    Jun 2003
    Posts
    22

    Question Unanswered: Making Lables

    Hello everyone,

    I'm working on something and I thought I would see if anyone had some suggestions. What I wanted to do was create a lable report that I could use to print out some lables. What I thought of doing was having a query that would ask for 2 sets of start and stop numbers (example 1 - 10000, and 10001 to 20000) it would then append these numbers to a table (preferably overwriting any data already in the table) then I could use a report to use these two sets of numbers, one running down the left and one set running down the right, to print out the lables. I have the concept but im not sure how to actually do this, im only new to access 2000.

    Thanks for any help on how this can be accomplished.

  2. #2
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34

    Re: Making Lables

    Hi,

    You don't have to make table for this (if I understand right that your want).

    Make unbound report (recordsource is empty)
    Insert right and left textbox and insert next code:


    Dim intLeftStart As Integer
    Dim intLeftStop As Integer
    Dim intRightStart As Integer
    Dim intRightStop As Integer

    Private Sub Report_Open(Cancel As Integer)
    On Error GoTo ErrCode

    '' Use form (or inputbux) to get values
    '' This example I use values 1001-2000 and 2001-3000
    intLeftStart = 1001
    intLeftStop = 2000
    intRightStart = 2001
    intRightStop = 3000

    If intLeftStop < intLeftStart _
    Or intRightStop < intRightStart _
    Or (intLeftStop - intLeftStart) <> (intRightStop - intRightStart) Then
    Cancel = True
    MsgBox "Values are not correct!"
    Exit Sub
    End If

    ExitCode:
    Exit Sub

    ErrCode:
    MsgBox Err.Description
    Resume ExitCode

    End Sub

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    On Error GoTo ErrCode

    '' I named TextBox LeftValue and RightValue
    Me.LeftValue.Value = intLeftStart
    Me.RightValue.Value = intRightStart


    If intLeftStart <> intLeftStop Then
    Me.MoveLayout = True
    Me.NextRecord = False
    End If


    intLeftStart = intLeftStart + 1
    intRightStart = intRightStart + 1

    ExitCode:
    Exit Sub

    ErrCode:
    MsgBox Err.Description
    Resume ExitCode


    End Sub
    Private Sub Detail_Retreat()
    intLeftStart = intLeftStart - 1
    intRightStart = intRightStart - 1
    End Sub


    This code has one problem - if your browse report up and down in preview window labels number could go crazy.
    You could resolve problem easily if you want one value for one page. You could use me.page -value to increase label number.

    Me.LeftValue.Value = intLeftStart + Me.Page
    Me.RightValue.Value = intRightStart + Me.Page

    If intLeftStart + Me.Page <> intLeftStop Then
    Me.MoveLayout = True
    Me.NextRecord = False
    End If

  3. #3
    Join Date
    Jun 2003
    Posts
    22

    Thumbs up

    Thanks!

    Great Idea, I just have one problem, when I go to next page the numbers have increased by more then one. Example the last number on the first page is 1020 and the first number on the second page will be 1022 when it should be 1021. Did you get this problem? If not could you please send me your example.

    I have attached mine so you can see what i mean.

    Also im not sure yet how I make the number ranges variables instead of set by VB. If its to much work don't worry about it, im sure i could figure it out eventually.
    Attached Files Attached Files

  4. #4
    Join Date
    Jun 2003
    Posts
    22

    Question

    Well I got the sequence of numbers working! Now if I can just figure out how to let the user enter their own values...

  5. #5
    Join Date
    Jun 2003
    Posts
    22

    Cool

    Great, I just figured out how to got the variables working, thanks for all the help guys.

Posting Permissions

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