Autonumber upon opening a form

G

Guest

I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



Ridnaway said:
I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the wrong
number of arguments." What was my error this time?
--
Ridnaway


BruceM said:
I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

Ridnaway said:
I apologize if it seems that I paid no attention to your previous posting.
In fact I did follow your link and tried to apply it. I would have even
paid
the $1 donation if I could've remembered my PayPal user/password. The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific table names
and field names. Certainly, in our multiple user environment getting a
duplicate numbering error will occur sooner or later and it will be good
to
have the knowledge to overcome that. For now, being an inexperienced user
I
guess I'll just have to muddle through this all until I can discuss it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my previous
posting,
but if you have a multi-user environment you will need to take steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm confused
about
which values to enter into the field properties though. I'm kind of
new
at
this and not entirely familiar with codes or syntax or expressions and
the
like. I've changed the field in the database from Autonumber to a text
field. Can I assume that in order to have the Work_Order_Number field
autopopulate that I should put an expression in the "default value"
property?
And if so would the expression then be =DMax[("table name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design view,
then
it
is a data entry form. Data entry forms are for entering new data.
They
always start off blank, but without acctually creating a record.

If you form opens up with the first record in the recordset showing,
then
it
is not a data entry form. If this is the case and your control for
the
autonumber field is bound to the autonumber field, then when you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use autonumbers as
data.
IMHO, users should never see them. They are intended to be used for
establishing key values for table relationships. One thing to be
aware
of is
that you will experience gaps in the numbering sequence. If a user
begins to
create a record, the cancels it, the number assigned is not reused.

Here is a method I use if I need a sequentially numbered field. It is
flexible enought it can be used even within a field that has other
repeating
values. For example, in once case, a user wanted a unique number that
was
Year, Month, and an incrementing number as in 2006040001, 2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader") + 1
End If

This emulates auto numbering, but leaves no gaps unless you delete a
record.
What happens is when you add a new record to your table, it looks for
the
highest value in the field you identify and adds 1 to it and puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data entry
form...didn't
know there was a difference. However, even if I begin entering data
in
the
next field it will not populate the autonumber. Thanks for your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is for
adding
new
records and comes up will all controls empty. That is because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders. I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening the
form.
The field
is my table is named Work_Order_Number and is set at autonumber
but
it isn't
placing the number onto the form when opened. What have I not
done?
 
G

Guest

Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to work
even when I followed your instructions to the letter. I've changed my data
type to a number with a long integer and placed the following string into the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL
John
--
Ridnaway


Klatuu said:
I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



Ridnaway said:
I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the wrong
number of arguments." What was my error this time?
--
Ridnaway


BruceM said:
I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous posting.
In fact I did follow your link and tried to apply it. I would have even
paid
the $1 donation if I could've remembered my PayPal user/password. The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific table names
and field names. Certainly, in our multiple user environment getting a
duplicate numbering error will occur sooner or later and it will be good
to
have the knowledge to overcome that. For now, being an inexperienced user
I
guess I'll just have to muddle through this all until I can discuss it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my previous
posting,
but if you have a multi-user environment you will need to take steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm confused
about
which values to enter into the field properties though. I'm kind of
new
at
this and not entirely familiar with codes or syntax or expressions and
the
like. I've changed the field in the database from Autonumber to a text
field. Can I assume that in order to have the Work_Order_Number field
autopopulate that I should put an expression in the "default value"
property?
And if so would the expression then be =DMax[("table name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design view,
then
it
is a data entry form. Data entry forms are for entering new data.
They
always start off blank, but without acctually creating a record.

If you form opens up with the first record in the recordset showing,
then
it
is not a data entry form. If this is the case and your control for
the
autonumber field is bound to the autonumber field, then when you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use autonumbers as
data.
IMHO, users should never see them. They are intended to be used for
establishing key values for table relationships. One thing to be
aware
of is
that you will experience gaps in the numbering sequence. If a user
begins to
create a record, the cancels it, the number assigned is not reused.

Here is a method I use if I need a sequentially numbered field. It is
flexible enought it can be used even within a field that has other
repeating
values. For example, in once case, a user wanted a unique number that
was
Year, Month, and an incrementing number as in 2006040001, 2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader") + 1
End If

This emulates auto numbering, but leaves no gaps unless you delete a
record.
What happens is when you add a new record to your table, it looks for
the
highest value in the field you identify and adds 1 to it and puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data entry
form...didn't
know there was a difference. However, even if I begin entering data
in
the
next field it will not populate the autonumber. Thanks for your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is for
adding
new
records and comes up will all controls empty. That is because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders. I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening the
form.
The field
is my table is named Work_Order_Number and is set at autonumber
but
it isn't
placing the number onto the form when opened. What have I not
done?
 
G

Guest

The problem is not obvious. It should work. The only thing I can see that
may make a difference is the domain name argument. Using spaces in names can
cause this behaviour. Best naming rule is - Use only Letters, Digits, and
the Underscore _ Do not use spaces, special characters, or reserved words.
Try putting brackets around the table name.
=DMax("[Work_Order_Number]","[2006 Work Orders]")+1

Good Name - Work_Order_Number
Bad Name - 2006 Work Orders
Two reasons, first, it has spaces, second, it is date specific. Are you
going to remember to change it before you begin using the database next year?


Ridnaway said:
Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to work
even when I followed your instructions to the letter. I've changed my data
type to a number with a long integer and placed the following string into the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL
John
--
Ridnaway


Klatuu said:
I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



Ridnaway said:
I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the wrong
number of arguments." What was my error this time?
--
Ridnaway


:

I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous posting.
In fact I did follow your link and tried to apply it. I would have even
paid
the $1 donation if I could've remembered my PayPal user/password. The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific table names
and field names. Certainly, in our multiple user environment getting a
duplicate numbering error will occur sooner or later and it will be good
to
have the knowledge to overcome that. For now, being an inexperienced user
I
guess I'll just have to muddle through this all until I can discuss it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my previous
posting,
but if you have a multi-user environment you will need to take steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm confused
about
which values to enter into the field properties though. I'm kind of
new
at
this and not entirely familiar with codes or syntax or expressions and
the
like. I've changed the field in the database from Autonumber to a text
field. Can I assume that in order to have the Work_Order_Number field
autopopulate that I should put an expression in the "default value"
property?
And if so would the expression then be =DMax[("table name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design view,
then
it
is a data entry form. Data entry forms are for entering new data.
They
always start off blank, but without acctually creating a record.

If you form opens up with the first record in the recordset showing,
then
it
is not a data entry form. If this is the case and your control for
the
autonumber field is bound to the autonumber field, then when you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use autonumbers as
data.
IMHO, users should never see them. They are intended to be used for
establishing key values for table relationships. One thing to be
aware
of is
that you will experience gaps in the numbering sequence. If a user
begins to
create a record, the cancels it, the number assigned is not reused.

Here is a method I use if I need a sequentially numbered field. It is
flexible enought it can be used even within a field that has other
repeating
values. For example, in once case, a user wanted a unique number that
was
Year, Month, and an incrementing number as in 2006040001, 2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader") + 1
End If

This emulates auto numbering, but leaves no gaps unless you delete a
record.
What happens is when you add a new record to your table, it looks for
the
highest value in the field you identify and adds 1 to it and puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data entry
form...didn't
know there was a difference. However, even if I begin entering data
in
the
next field it will not populate the autonumber. Thanks for your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is for
adding
new
records and comes up will all controls empty. That is because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders. I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening the
form.
The field
is my table is named Work_Order_Number and is set at autonumber
but
it isn't
placing the number onto the form when opened. What have I not
done?
 
C

Craig Hornish

Ridnaway said:
Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to
work
even when I followed your instructions to the letter. I've changed my
data
type to a number with a long integer and placed the following string into
the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL

I'll look at it. Fee - 1 pint of blood to the Red Cross (I won't hold you
too it)
Just zip it and send it to me.

Craig Hornish
chornish at cap-associates.com

John
--
Ridnaway


Klatuu said:
I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



Ridnaway said:
I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form
and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the
wrong
number of arguments." What was my error this time?
--
Ridnaway


:

I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen
later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous
posting.
In fact I did follow your link and tried to apply it. I would have
even
paid
the $1 donation if I could've remembered my PayPal user/password.
The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific
table names
and field names. Certainly, in our multiple user environment
getting a
duplicate numbering error will occur sooner or later and it will be
good
to
have the knowledge to overcome that. For now, being an
inexperienced user
I
guess I'll just have to muddle through this all until I can discuss
it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my
previous
posting,
but if you have a multi-user environment you will need to take
steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm
confused
about
which values to enter into the field properties though. I'm
kind of
new
at
this and not entirely familiar with codes or syntax or
expressions and
the
like. I've changed the field in the database from Autonumber to
a text
field. Can I assume that in order to have the Work_Order_Number
field
autopopulate that I should put an expression in the "default
value"
property?
And if so would the expression then be =DMax[("table
name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name
is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design
view,
then
it
is a data entry form. Data entry forms are for entering new
data.
They
always start off blank, but without acctually creating a
record.

If you form opens up with the first record in the recordset
showing,
then
it
is not a data entry form. If this is the case and your control
for
the
autonumber field is bound to the autonumber field, then when
you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use
autonumbers as
data.
IMHO, users should never see them. They are intended to be
used for
establishing key values for table relationships. One thing to
be
aware
of is
that you will experience gaps in the numbering sequence. If a
user
begins to
create a record, the cancels it, the number assigned is not
reused.

Here is a method I use if I need a sequentially numbered field.
It is
flexible enought it can be used even within a field that has
other
repeating
values. For example, in once case, a user wanted a unique
number that
was
Year, Month, and an incrementing number as in 2006040001,
2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do
this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader")
+ 1
End If

This emulates auto numbering, but leaves no gaps unless you
delete a
record.
What happens is when you add a new record to your table, it
looks for
the
highest value in the field you identify and adds 1 to it and
puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data
entry
form...didn't
know there was a difference. However, even if I begin
entering data
in
the
next field it will not populate the autonumber. Thanks for
your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is
for
adding
new
records and comes up will all controls empty. That is
because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders.
I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening
the
form.
The field
is my table is named Work_Order_Number and is set at
autonumber
but
it isn't
placing the number onto the form when opened. What have
I not
done?
 
G

Guest

I'll do it for a pint of Glen Fidich
Just zip it and sent it to me. (The Scotch, not the mdb :))

Craig Hornish said:
Ridnaway said:
Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to
work
even when I followed your instructions to the letter. I've changed my
data
type to a number with a long integer and placed the following string into
the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL

I'll look at it. Fee - 1 pint of blood to the Red Cross (I won't hold you
too it)
Just zip it and send it to me.

Craig Hornish
chornish at cap-associates.com

John
--
Ridnaway


Klatuu said:
I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



:

I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form
and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the
wrong
number of arguments." What was my error this time?
--
Ridnaway


:

I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen
later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous
posting.
In fact I did follow your link and tried to apply it. I would have
even
paid
the $1 donation if I could've remembered my PayPal user/password.
The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific
table names
and field names. Certainly, in our multiple user environment
getting a
duplicate numbering error will occur sooner or later and it will be
good
to
have the knowledge to overcome that. For now, being an
inexperienced user
I
guess I'll just have to muddle through this all until I can discuss
it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my
previous
posting,
but if you have a multi-user environment you will need to take
steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm
confused
about
which values to enter into the field properties though. I'm
kind of
new
at
this and not entirely familiar with codes or syntax or
expressions and
the
like. I've changed the field in the database from Autonumber to
a text
field. Can I assume that in order to have the Work_Order_Number
field
autopopulate that I should put an expression in the "default
value"
property?
And if so would the expression then be =DMax[("table
name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name
is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design
view,
then
it
is a data entry form. Data entry forms are for entering new
data.
They
always start off blank, but without acctually creating a
record.

If you form opens up with the first record in the recordset
showing,
then
it
is not a data entry form. If this is the case and your control
for
the
autonumber field is bound to the autonumber field, then when
you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use
autonumbers as
data.
IMHO, users should never see them. They are intended to be
used for
establishing key values for table relationships. One thing to
be
aware
of is
that you will experience gaps in the numbering sequence. If a
user
begins to
create a record, the cancels it, the number assigned is not
reused.

Here is a method I use if I need a sequentially numbered field.
It is
flexible enought it can be used even within a field that has
other
repeating
values. For example, in once case, a user wanted a unique
number that
was
Year, Month, and an incrementing number as in 2006040001,
2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do
this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader")
+ 1
End If

This emulates auto numbering, but leaves no gaps unless you
delete a
record.
What happens is when you add a new record to your table, it
looks for
the
highest value in the field you identify and adds 1 to it and
puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data
entry
form...didn't
know there was a difference. However, even if I begin
entering data
in
the
next field it will not populate the autonumber. Thanks for
your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is
for
adding
new
records and comes up will all controls empty. That is
because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders.
I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening
the
form.
The field
is my table is named Work_Order_Number and is set at
autonumber
but
it isn't
placing the number onto the form when opened. What have
I not
done?
 
G

Guest

Klatuu,

Apparently I gave up before receiving your kind offer a couple months ago.
I'm back at it now and wondering if your offer still holds. If so, let me
know where to send the file and the scotch :) You can also contact me at
(e-mail address removed).

Klatuu said:
I'll do it for a pint of Glen Fidich
Just zip it and sent it to me. (The Scotch, not the mdb :))

Craig Hornish said:
Ridnaway said:
Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to
work
even when I followed your instructions to the letter. I've changed my
data
type to a number with a long integer and placed the following string into
the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL

I'll look at it. Fee - 1 pint of blood to the Red Cross (I won't hold you
too it)
Just zip it and send it to me.

Craig Hornish
chornish at cap-associates.com

John
--
Ridnaway


:

I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



:

I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form
and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the
wrong
number of arguments." What was my error this time?
--
Ridnaway


:

I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen
later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous
posting.
In fact I did follow your link and tried to apply it. I would have
even
paid
the $1 donation if I could've remembered my PayPal user/password.
The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific
table names
and field names. Certainly, in our multiple user environment
getting a
duplicate numbering error will occur sooner or later and it will be
good
to
have the knowledge to overcome that. For now, being an
inexperienced user
I
guess I'll just have to muddle through this all until I can discuss
it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my
previous
posting,
but if you have a multi-user environment you will need to take
steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm
confused
about
which values to enter into the field properties though. I'm
kind of
new
at
this and not entirely familiar with codes or syntax or
expressions and
the
like. I've changed the field in the database from Autonumber to
a text
field. Can I assume that in order to have the Work_Order_Number
field
autopopulate that I should put an expression in the "default
value"
property?
And if so would the expression then be =DMax[("table
name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name
is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design
view,
then
it
is a data entry form. Data entry forms are for entering new
data.
They
always start off blank, but without acctually creating a
record.

If you form opens up with the first record in the recordset
showing,
then
it
is not a data entry form. If this is the case and your control
for
the
autonumber field is bound to the autonumber field, then when
you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use
autonumbers as
data.
IMHO, users should never see them. They are intended to be
used for
establishing key values for table relationships. One thing to
be
aware
of is
that you will experience gaps in the numbering sequence. If a
user
begins to
create a record, the cancels it, the number assigned is not
reused.

Here is a method I use if I need a sequentially numbered field.
It is
flexible enought it can be used even within a field that has
other
repeating
values. For example, in once case, a user wanted a unique
number that
was
Year, Month, and an incrementing number as in 2006040001,
2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do
this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader")
+ 1
End If

This emulates auto numbering, but leaves no gaps unless you
delete a
record.
What happens is when you add a new record to your table, it
looks for
the
highest value in the field you identify and adds 1 to it and
puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data
entry
form...didn't
know there was a difference. However, even if I begin
entering data
in
the
next field it will not populate the autonumber. Thanks for
your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is
for
adding
new
records and comes up will all controls empty. That is
because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders.
I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening
the
form.
The field
is my table is named Work_Order_Number and is set at
autonumber
but
it isn't
placing the number onto the form when opened. What have
I not
done?
 
G

Guest

Klatuu, you're my hero. I've been trying to figure out the same problem
because I, too, have "Bad" Names (I'm an antropologist-- spaces are second
nature!) ANyway, the bracket suggestion worked where nothing else had.
You've completely coaxed me off the ledge.
Thanks!

Klatuu said:
The problem is not obvious. It should work. The only thing I can see that
may make a difference is the domain name argument. Using spaces in names can
cause this behaviour. Best naming rule is - Use only Letters, Digits, and
the Underscore _ Do not use spaces, special characters, or reserved words.
Try putting brackets around the table name.
=DMax("[Work_Order_Number]","[2006 Work Orders]")+1

Good Name - Work_Order_Number
Bad Name - 2006 Work Orders
Two reasons, first, it has spaces, second, it is date specific. Are you
going to remember to change it before you begin using the database next year?


Ridnaway said:
Hello again Klatuu

I gave up on this problem for a while because I just couldn't get it to work
even when I followed your instructions to the letter. I've changed my data
type to a number with a long integer and placed the following string into the
default value property of the Work_Order_Number field:
=DMax("[Work_Order_Number]","2006 Work Orders")+1
But then when I go back to Form View mode the field is populated with
"#Error". Do you know of anyone whom I can just send this database to and
have them fix it for a fee? LOL
John
--
Ridnaway


Klatuu said:
I believe that was my fault because of a typo.
It should be:
=DMax("[Work_Order_Number]","2006 Work Orders")+1



:

I think my 1st reply to this got lost somehow so I'll try again :)

Thank you for your thoughts. I changed the form to a data entry form and
typed the following expression into the Defaul Value line of the
Work_Order_Number field......=Max("[Work_Order_Number]","2006 Work
Orders")+1. But when I tried to exit I got the following error
message......"The expression you entered has a function containing the wrong
number of arguments." What was my error this time?
--
Ridnaway


:

I can get a bit testy at times. It doesn't help anything.

As Klatuu observed, get it working first. Multi-user can happen later. I
expect you are going to test it first for a while, so multi-user
environments aren't the first concern.

I apologize if it seems that I paid no attention to your previous posting.
In fact I did follow your link and tried to apply it. I would have even
paid
the $1 donation if I could've remembered my PayPal user/password. The
problem was that I became confused by the code
language/strings/expressions
and was unable to make sense of how to apply it to my specific table names
and field names. Certainly, in our multiple user environment getting a
duplicate numbering error will occur sooner or later and it will be good
to
have the knowledge to overcome that. For now, being an inexperienced user
I
guess I'll just have to muddle through this all until I can discuss it in
terms the experts are familiar with.

Have a good day Sir
--
Ridnaway


:

I expect you will pay no more attention to this than to my previous
posting,
but if you have a multi-user environment you will need to take steps to
guard against errors if two users enter a record at the same time.

Thanks! That sounds like just what I want it to do. I'm confused
about
which values to enter into the field properties though. I'm kind of
new
at
this and not entirely familiar with codes or syntax or expressions and
the
like. I've changed the field in the database from Autonumber to a text
field. Can I assume that in order to have the Work_Order_Number field
autopopulate that I should put an expression in the "default value"
property?
And if so would the expression then be =DMax[("table name","field
name")]+1
? (the table name is "2006 Work Orders" and the field name is
"Work
Order Number"
--
Ridnaway


:

If the Data Entry property of the form is set to Yes in design view,
then
it
is a data entry form. Data entry forms are for entering new data.
They
always start off blank, but without acctually creating a record.

If you form opens up with the first record in the recordset showing,
then
it
is not a data entry form. If this is the case and your control for
the
autonumber field is bound to the autonumber field, then when you
create a
new
record, the number should show up.

I am a little lost on a solution because I never use autonumbers as
data.
IMHO, users should never see them. They are intended to be used for
establishing key values for table relationships. One thing to be
aware
of is
that you will experience gaps in the numbering sequence. If a user
begins to
create a record, the cancels it, the number assigned is not reused.

Here is a method I use if I need a sequentially numbered field. It is
flexible enought it can be used even within a field that has other
repeating
values. For example, in once case, a user wanted a unique number that
was
Year, Month, and an incrementing number as in 2006040001, 2006040002,
2006050001, etc
But for example purposes, I will show you the basic way to do this.
Use
the
form's current event:

If Me.NewRecord then
Me.txtOrderNumber = Max("[OrderNumber]", "tblOrderHeader") + 1
End If

This emulates auto numbering, but leaves no gaps unless you delete a
record.
What happens is when you add a new record to your table, it looks for
the
highest value in the field you identify and adds 1 to it and puts it
in
the
text box for the order number.

:

It is a form. I'm not sure how to identify it as a data entry
form...didn't
know there was a difference. However, even if I begin entering data
in
the
next field it will not populate the autonumber. Thanks for your
help.
Any
other thoughts?
--
Ridnaway


:

If your form is defined as a Data Entry form, then it is for
adding
new
records and comes up will all controls empty. That is because a
record is
not actually created until you start entering data.

:

I am using a form to populate my database of work orders. I
have a
text box
on the form named "Work Order Number" and I want it to
automatically place
the next sequential number into this field upon opening the
form.
The field
is my table is named Work_Order_Number and is set at autonumber
but
it isn't
placing the number onto the form when opened. What have I not
done?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top