How to increment no?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eneyardi
    New Member
    • Jul 2010
    • 180

    How to increment no?

    How to increment no? when you have two fields in a table val1 en employee name. in a form u have this two as controlsource, the first textbox is val1 en the 2nd one is employee name. i have a command button add new record. how do i automatically increment the val1 textbox everytime i add new record. my table name is table1.
    this is the code i made but it says invalid use of null

    if me.newrecord then
    me.val1=nz(Dmax (me.val1,"table 1",0))+1
    end if
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Assuming Val1 is the actual Field 'Name' in 'Table1':
    Code:
    Me.Val1=Nz(Dmax("[Val1]","table1",0))+1

    Comment

    Working...