Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Aug 2002
    Location
    Michigan, USA
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default value taken from another field (2002)

    Hi, thanks for reading. I have a "Proposal Number" field in a database that ends with 2127. When a user creates a new record, I want the default value for the "Proposal Number" to be the last "Proposal Number" value +1 (in this example, the default value for the new "Proposal Number" would be 2128). How might I accomplish this??? Thanks for your help...!!!

  2. #2
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Warwick, Warwickshire, England
    Posts
    189
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default value taken from another field (2002)

    You could look for the maximum value in the database and add 1 to this.
    i.e. DMAX(table,field,criteria)

    e.g. DMAX("tablename","ProposalNumber")

    John

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Default value taken from another field (2002)

    In the on current event of the form you could use :
    <pre>If Me.NewRecord = True Then
    Me.txtProposalNumber = DMax("ProposalNumber", "YourTable") + 1
    End If</pre>

    This will work for a single user database.
    If it is a multi user database, you would use this in the Before Insert of the form.
    Francois

Posting Permissions

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