Auto numbers

  • Thread starter Thread starter Ran BD
  • Start date Start date
R

Ran BD

I have a small issue I have a form based on a TABLE called Sup_Tbl with an
account number field in it.
account number isn't the primary key in the table. but I want the number to
be a consecutive running number, issued automatically by the system, how do
I do that ?

thanks
Ran
 
Ran,
Add a Long numeric field to your table (Sup_Tbl), make it Indexed-No
Duplicates, name it [AcctNo].
Place that "bound" field on your form, and set it's Locked = Yes, and
TabStop=No... since you don't need to access this field, or edit it. (I
usually leave Enabled = True for "finding" records by AcctNo, but you can
customize to suit.)
Place this calculation in the DefaultValue of that field...
= DMax("[AcctNo]", "Sup_Tbl") + 1
Whenever you open a New record, The Default value calculation will place
a number 1 higher than the maximum presently in the table.
 
Al, as I want the value to appear only when the field is getting focus, I
left the tab property set to yes and add {Me.Mis_Han.DefaultValue = """ &
DMax(([Sapak_Tbl]![Mis_han])+1) & """} on the get-focus property, while
[Sapak_tbl] is the table that field [Mis_han] is stored at (Hebrew names
disregard) the thing is I'm getting an error as a result, any idea ?

thanks

Al Camp said:
Ran,
Add a Long numeric field to your table (Sup_Tbl), make it Indexed-No
Duplicates, name it [AcctNo].
Place that "bound" field on your form, and set it's Locked = Yes, and
TabStop=No... since you don't need to access this field, or edit it. (I
usually leave Enabled = True for "finding" records by AcctNo, but you can
customize to suit.)
Place this calculation in the DefaultValue of that field...
= DMax("[AcctNo]", "Sup_Tbl") + 1
Whenever you open a New record, The Default value calculation will place
a number 1 higher than the maximum presently in the table.
--
HTH...
Al Campagna
Candia Computer Consulting
Candia, NH



Ran BD said:
I have a small issue I have a form based on a TABLE called Sup_Tbl with an
account number field in it.
account number isn't the primary key in the table. but I want the number to
be a consecutive running number, issued automatically by the system, how do
I do that ?

thanks
Ran
 
What field type is [Mis_han]?

You wanted (from your first post) a "consecutive running
number". Yet, by adding the quotes, it appears you defined
the field as text (can't add a number to a string and get
a "consecutive running number"). Or the field is numeric
and you are trying to store a string. Hence an error.

Try this:

Me.Mis_Han.DefaultValue = DMax(([Sapak_Tbl]![Mis_han])+1

Make sure that [Sapak_Tbl]![Mis_han] is numeric (long
integer).

HTH

Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

-----Original Message-----
Al, as I want the value to appear only when the field is getting focus, I
left the tab property set to yes and add
{Me.Mis_Han.DefaultValue = """ &
DMax(([Sapak_Tbl]![Mis_han])+1) & """} on the get-focus property, while
[Sapak_tbl] is the table that field [Mis_han] is stored at (Hebrew names
disregard) the thing is I'm getting an error as a result, any idea ?

thanks

Al Camp said:
Ran,
Add a Long numeric field to your table (Sup_Tbl), make it Indexed-No
Duplicates, name it [AcctNo].
Place that "bound" field on your form, and set it's Locked = Yes, and
TabStop=No... since you don't need to access this field, or edit it. (I
usually leave Enabled = True for "finding" records by AcctNo, but you can
customize to suit.)
Place this calculation in the DefaultValue of that field...
= DMax("[AcctNo]", "Sup_Tbl") + 1
Whenever you open a New record, The Default value
calculation will
place
a number 1 higher than the maximum presently in the table.
--
HTH...
Al Campagna
Candia Computer Consulting
Candia, NH
called Sup_Tbl with
an
but I want the number
to by the system, how
do


.
 
Back
Top