Results 1 to 2 of 2
  1. #1
    cev2010 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2011
    Posts
    1

    Question Can i add a query to a form already set up or do i .......

    In Access 2003:



    I have set up a query to work out the next number for the customer ID field based on the max no already in the table. I have then set up an add new customer form and want the customer id to automatically appear as the updated field from the query

    I'm guessing i may not be able to do that, so i have built an event on the customer ID field in the form that reads

    =DMax(“[Customer ID]”,”tblCustomer”)+1


    But that does seem to work either - i basically need a form that generates a new customer id based on the max, but i cant have it set as an autonumber field


    Any suggestions?
    Thanks

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Why do you say the Dmax function call is incorrect? How are you using the expression, and do you get an error message?

    Try setting the Customer_ID on the form using the On Current event, but only when the record is new:

    if me.newrecord then me![Customer ID] = DMax(“[Customer ID]”,”tblCustomer”)+1

    John

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

Similar Threads

  1. To open a form, sub form if text box entry exist in Query
    By george.vniekerk in forum Programming
    Replies: 2
    Last Post: 08-08-2011, 12:50 AM
  2. Query to only show a value in a form from a query
    By cwwaicw311 in forum Queries
    Replies: 28
    Last Post: 03-27-2010, 02:31 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