Results 1 to 4 of 4
  1. #1
    rajgoyal00 is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    26

    AutoNumber within a Range

    Hi, I started working on this project about a month ago, with no knowledge of access. I know a lot more now than I did. But I am stuck in a Phase of it and I need help from you good people.

    I have a Drop_Envelopes Table with 5 fields:
    1. [ID] = AutoNumber (Using it just because I should have a primary KEY) Dont really need it
    2. [DATEVAL] = Date For that Day
    3. [Envelope_No] = NUMBER (Envelope Drops in Safe)
    4. [CASH] = Currency (Amount of cash in the Envelope)
    5. [Checks] = Currency (Amounty of checks in the Envelops)
    Purpose: We drop envelopes in a safe. This records which envelope no. had how much cash or checks.

    Problem (FOR NOW): The Envelopes we have Cycle from #1 - # 80



    In a day's time we can go through 6 or 7 envelopes, (The numbering is in series).

    I want my form to Auto Generate my envelope No. and cycle through 1-80 (could be the same day or the next). The form Openes when cliked on button on a diffrent form and filters with That Form's date.

    I tried using Dlast("[Envelope_No]","[Drop_Envelopes]") +1 in the default value of the field in the form and also in "Before Update" Event of the field.

    I am using a split form (I need the datasheet vew so I can see what all I have entered for the day)
    When I start entering a new record, the datasheet view generates another row with DLAST working. For example: If I am working on envelope NO.1 and press Enter. It auto Populates #2 on the next row, but As soon as I start working on #2 , the next row(third) becomes #2. because the last record it recognizes is #1 and #2 hasnt been registered yet. So Its not going to work for me.
    As far as looping, ( I havent gotten to that part)

    I can really use some help. Please reply with any idea you have. Any help will be greayly appreciated.
    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I think you are going to have to learn some vba and looping.
    Currently your DLast(..) is working for each record. You need it to be done only when you go to a new Envelop.

    Also, most people will advise you to use DMax rather than DLast.
    Code:
    Start
    if all done then exit
    else
    Get New Envelop Number  DMAX statement
       For each record 
          do the record stuff
               the cash
               the checks
        next record
    next envelop
    endif
    Logic is something like the above in general terms.

    Good luck

  3. #3
    rajgoyal00 is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    26
    Thanks for a reply, I kind if knew that its gonna have to be in VBA. But If some one can give me some clear directions, It will really help. I have been trying to dfind a solution from a while now! Thanks Again

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Have you been trying to code this? Do you need to learn VBA? Start with this http://office.microsoft.com/en-us/ac...010341717.aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. AutoNumber Question
    By Rick5150 in forum Access
    Replies: 9
    Last Post: 10-16-2011, 01:43 PM
  2. Autonumber SQL INSERT INTO
    By eww in forum Programming
    Replies: 16
    Last Post: 03-04-2011, 03:29 PM
  3. Help with autonumber
    By GDubbs780 in forum Programming
    Replies: 15
    Last Post: 02-27-2011, 02:27 PM
  4. Replies: 2
    Last Post: 11-25-2010, 11:01 AM
  5. AUTONUMBER
    By J A F F A in forum Database Design
    Replies: 1
    Last Post: 10-03-2007, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums