Results 1 to 3 of 3
  1. #1
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15

    lookup next ref on data entry

    Hi all

    I'm having brain freeze over a database I am workin on and can't seem to find a way to make it work

    What I'm looking to do is:

    I have an account activity table that has an activity id, activity type (eg
    invoice, credit note, payment, deposit etc etc), Ref and a number of other fields. The activity id is an auto number and what i want is to have the Ref to also be an auto number but be determined by the activity type so for example
    i enter a new activity which for example is a invoice it looks up the last ref for an invoice type (type 2) and uses the next number - if i enter a credit note it looks up last number credit note as property type and uses the next number for credit note

    I thought of using something like

    on update

    Me.Ref = Format(DMax("ActivityID", "Activity", Type= "2") + 1)

    not sure if I'm on the right track would this even work?
    Cheers

    Jackie

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    For starters, this:

    Type= "2"

    likely needs to be

    "Type= 2"

    Also, I would think you'd want the max of Ref, not ActivityID.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jackie is offline Novice
    Windows Vista Access 2007
    Join Date
    Mar 2011
    Posts
    15
    Thanks paul - I'm goin to work on it tonight and see how it goes

    Cheers
    Jackie

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

Similar Threads

  1. Entering data in forms with lookup tables
    By gretsch in forum Forms
    Replies: 1
    Last Post: 11-16-2010, 11:44 AM
  2. data entry
    By ngeng4 in forum Forms
    Replies: 22
    Last Post: 03-18-2010, 07:12 PM
  3. Replies: 2
    Last Post: 01-25-2010, 09:23 AM
  4. Invisible LookUp Data List
    By aaghd in forum Access
    Replies: 3
    Last Post: 07-28-2009, 02:35 PM
  5. Data Entry And Data Recalling
    By GeeDee in forum Access
    Replies: 0
    Last Post: 05-01-2007, 05:20 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