Form calculated field (1 Viewer)

danilogg

New member
Local time
Today, 15:53
Joined
Jan 16, 2013
Messages
2
Hi all,

I have a table with these fields:

ID, Code, AssetType, Region and other fields

I am creating a form to add new records to this table. After typing the info I should click a button to create the new record and the form should give me a popup with the code for this article and record the new asset with the corresponding code.

The form must be used only to add new records.

The ID is the primary key "AutoNumber"
The AssetType and Region are numeric values from 1 to 99 selected from a drop-down list
The Code must be built based on the previous values in this way:

code = "RRTT####", where RR = region code, TT = asset type and #### = ID

If Region is less than 9 the code must have a zero at the beginning
Is AssetType is less than 9 I must have a zero at the beginning
If ID is less than 1000, I must format it with zeros at the left to make the code even.
All codes must have 8 characters.

i.e.
Region = 5
Asset type = 7
ID = 23
the code must be 05070023

Could you please help me with the code that I need to add in my form and let me know where should I add that code?

I think that must be a macro associated with the button to add the record, but I do not know where to write the macro and how to add it in the button.

Danilo :confused:
 

Users who are viewing this thread

Top Bottom