anum instr

Upload: ckaratzoglou

Post on 02-Jun-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Anum Instr

    1/3

    This is a step-by-step on how to setup the AutoNumbers functionality. We will use

    Purchase Orders as an example.

    1)

    Jot down the name of the main table, and the field that will hold the number that will beincremented for new records. ou will ha!e to add these to the function later so it can

    chec" a#ainst this table and field to ma"e sure no duplicates are bein# created.

    As an example, we$ll use %tblPurchaseOrders% and %fld&'% as the table and field name.

    2)

    (reate a new table with one field. Name the field whate!er you want - it doesn$t matterso lon# as there is only one field.

    This field needs to be a )on# &nte#er datatype.

    *emo!e the 'efault +alue of lea!e it blan"

    This field will only ha!e one record at any time. &f you ha!e a number you want to start

    with, open the table and create ON/ */(O*' ON) with that number. This table can

    ne!er ha!e more than one record. &f you want to start from 0, do not enter a record in thetable.

    Jot down this table name as well.

    As an example, we$ll use %tblANumPurchaseOrders%

    3)

    Open the +1 /ditor and #o to basAutoNumbers.

    &n the eAutoNumbers /num at the top of the module, enter distinct name and !alue todescribe this autonumber. The name or !alue doesn$t matter so lon# as the !alue is a lon#

    inte#er and it is not the same as any existin# !alues.

    The description you #i!e this will be shown as a selection option when you call thefunction.

    /xample2-----

    Public /num eAutoNumbers

    PurchaseOrder 3 /nd /num

    -----

    When you call the function, PurchaseOrder will appear as a selection option.

  • 8/11/2019 Anum Instr

    2/3

    4)

    4o to the 4etAutoNum function in the +1 /ditor. &n the body of the function you will

    see a %5elect (ase lANum%. ou will need to apply some !alues to the !ariables in thisfunction.

    (reate a new line %(ase 6our /num 'esc7%

    6our /num 'esc7 must match either the !alue that you put in the enum, or the name

    that you #a!e the !alue.

    &n this example, we used PurchaseOrder as a description and as a !alue, so either one of

    the followin#2

    (ase PurchaseOrder

    or

    (ase

    &n the three lines after this, you will ha!e to apply the !alues of the three pieces of

    information that we pre!iously 8otted down.

    sTable2 the name of the table that you 8ust created to hold the current !alue

    s'upTestTable2 the name of the first table that you 8otted down, which containsthe actual records

    s9ey:ield2 the name of the field in the first table that holds the completed !alue

    Apply these !alues accordin#ly. :or our example2

    (ase sTable 3 %tblANumPurchaseOrders%

    s'upTestTable 3 %tblPurchaseOrders%

    s9ey:ield 3 %fld&'%

    ;

    (ompile all modules and sa!e.

  • 8/11/2019 Anum Instr

    3/3