From: clk on
I have a continuous form where the first field in the form is a serial
number. It starts with 1 and increments each time a new record is
added. I want to autoincrement this field. It is set as a number. I
do not want to use autonumber for this field.

Serial Number Rev Number Date of Test
1 1 03/03/2010
2 1 03/03/2010
3 1 03/04/2010

Is this possible without an autonumber in a continuous form?

Any suggestions are appreciated.

From: Salad on
clk wrote:

> I have a continuous form where the first field in the form is a serial
> number. It starts with 1 and increments each time a new record is
> added. I want to autoincrement this field. It is set as a number. I
> do not want to use autonumber for this field.
>
> Serial Number Rev Number Date of Test
> 1 1 03/03/2010
> 2 1 03/03/2010
> 3 1 03/04/2010
>
> Is this possible without an autonumber in a continuous form?
>
> Any suggestions are appreciated.
>

In the Before_Update event of the form, you could do something like
Me.SerialNumber = Dmax("SerialNumber","YourTableName") + 1
if it passes all validation checks.

From: David W. Fenton on
Salad <salad(a)oilandvinegar.com> wrote in
news:uNKdnYL75uk9vA3WnZ2dnUVZ_t6dnZ2d(a)earthlink.com:

> In the Before_Update event of the form, you could do something
> like
> Me.SerialNumber = Dmax("SerialNumber","YourTableName") + 1
> if it passes all validation checks.

Don't you mean Before_Insert? If you use Before_Update it will
change the value every time the record is edited, rather than each
time a record is added (which is hat I understand was requested).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: Salad on
David W. Fenton wrote:

> Salad <salad(a)oilandvinegar.com> wrote in
> news:uNKdnYL75uk9vA3WnZ2dnUVZ_t6dnZ2d(a)earthlink.com:
>
>
>>In the Before_Update event of the form, you could do something
>>like
>> Me.SerialNumber = Dmax("SerialNumber","YourTableName") + 1
>>if it passes all validation checks.
>
>
> Don't you mean Before_Insert? If you use Before_Update it will
> change the value every time the record is edited, rather than each
> time a record is added (which is hat I understand was requested).
>
Personally, I wouldn't do it at B4Insert. I'd do it it at the save time
in case the added record is aborted. But I'd probably have a
If Me.NewRecord then
statement preceeding the calc if I were to use that method.
From: Marshall Barton on
Salad wrote:

>clk wrote:
>> I have a continuous form where the first field in the form is a serial
>> number. It starts with 1 and increments each time a new record is
>> added. I want to autoincrement this field. It is set as a number. I
>> do not want to use autonumber for this field.
>>
>> Serial Number Rev Number Date of Test
>> 1 1 03/03/2010
>> 2 1 03/03/2010
>> 3 1 03/04/2010
>>
>> Is this possible without an autonumber in a continuous form?
>>
>> Any suggestions are appreciated.
>>
>
>In the Before_Update event of the form, you could do something like
> Me.SerialNumber = Dmax("SerialNumber","YourTableName") + 1
>if it passes all validation checks.


To avoid modifying existing records, that line should be
after:
If Me.NewRecord Then

--
Marsh
 |  Next  |  Last
Pages: 1 2
Prev: Auto restart possible ??
Next: Startup