Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2003
    Posts
    13

    Question Unanswered: Simple record counter in report

    HELP! HELP! HELP!

    I've made a report that makes selections based on criteria I can give.
    The result however must contain a articlenumber combined with a counting number.

    Like so: AXO940001001-005426. The last 6 digits is the counting number, but HOW TO GET THIS DONE?

    The (starting) counternumber must also be adjustable so different series can be made.

    Example:
    I give in a number to start counting at: 005243
    I have a 100 records displayed in the report.
    The new numbers should be like this:
    AXO9400010001-005243
    AXO9400010001-005244
    AXO9400010001-005245
    etc.

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    There's multiple ways to do this. Here's a simple one...

    Dim strID as string, intCntr as integer, strCntr as string * 6
    Dim strArtNum as string, intPos as integer
    strCntr = String(6,"0")
    'get your last article & counter number
    strArtNum = ArticleNumber
    'extract the counter number
    intCntr =Cint(right(strArtNum,6)
    intCntr=intCntr+1
    'how many of the 6 digits are we using?
    intPos= len(Cstr(intCntr))
    strCntr=left(strcntr,6-intPos) & cstr(intcntr)
    'find the position of the '-'
    intPos = Instr(1, strArtNum, "-")
    'replace the counting number
    strArtNum = left(strArtNum,intPos) & strCntr
    Inspiration Through Fermentation

  3. #3
    Join Date
    Jul 2003
    Posts
    13

    Talking

    I really appreciate your answer, but I'm not really a VB wizzkid!

    Where should I put this code you gave me?

    Tnx !

  4. #4
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    I might have made a bad assumption here...

    Are you storing the combination of Article Number and counter anywhere
    in your DB? Or are you making up the counter numbers on the fly?
    Inspiration Through Fermentation

  5. #5
    Join Date
    Jul 2003
    Posts
    13
    I'd rather not store the counter number, because it might make it even more difficult to handle. The counter numbers are preferably based on the input of a 6 digit startnumber.

  6. #6
    Join Date
    Jul 2003
    Posts
    13

    Question

    I'd really appreciate it if you could help me!

    My reports are have just gaind a priority status up to nr1.

    Tnx in advance!

  7. #7
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Can you attach what you have so far? I'll make changes and send it back.
    Inspiration Through Fermentation

  8. #8
    Join Date
    Jul 2003
    Posts
    13

    Wink

    Here it is! Hope you can fix it.
    Attached Files Attached Files

  9. #9
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    This should do it. I changed the last text box on the report to show the
    value you asked for. When you open the report, you are asked for a starting counter number.

    Open the report in design view, and click on the 'Code' button on the
    toolbar. That will take you into the module for the report. There's not
    much code involved, but I put plenty of comments in to explain what's going on.

    Hope that's what you need!
    Mark
    Attached Files Attached Files
    Inspiration Through Fermentation

  10. #10
    Join Date
    Jul 2003
    Posts
    13

    Talking

    YESSSSSSSS...

    IT WORKS !!!

    Thank you very much for helping. I really have to study more VB.

    Best regards,

    Michael Beck
    maabeck@hotmail.com

Posting Permissions

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