creating new record with new file number which is not an auto number

L

Larry Rekow

setup: iis 5
creating pages using FP

good at using FP...but currently very limited in ASP 3.0
and promising to buy book today and learn!

need help to let users create a new file that results
in a new file number (the field is named "reference")
that checks the highest current number and increments
it by one.

when the user has saved the new file, the confirmation page,
whether automatically generated or custom will
show them the new number...i can handle that....

the help i need is in saving the perhaps hidden field with
a value that first checks the max number and increments it by one.

desperately want to avoid several users possibly trying to save the
same number at the same time...or perhaps have a custom error which
will allow them to try again without having them re-type in their
info.

many thanks if you can help.

L.




- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
L

Larry Rekow

meant to add that i'm also using an access
d/b via a DSN...and want users to create
a new *record*, not file...sorry.

L
setup: iis 5
creating pages using FP

good at using FP...but currently very limited in ASP 3.0
and promising to buy book today and learn!

need help to let users create a new file that results
in a new file number (the field is named "reference")
that checks the highest current number and increments
it by one.

when the user has saved the new file, the confirmation page,
whether automatically generated or custom will
show them the new number...i can handle that....

the help i need is in saving the perhaps hidden field with
a value that first checks the max number and increments it by one.

desperately want to avoid several users possibly trying to save the
same number at the same time...or perhaps have a custom error which
will allow them to try again without having them re-type in their
info.

many thanks if you can help.

L.




- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
T

Thomas A. Rowe

Use the Autonumber file in the database, and set it as the Primary Key
field. Then visit the following site to learn how to get this auto number
back to display:

http://www.kamath.com/tutorials/tut004_autonum.asp

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
T

Thomas A. Rowe

File should read Field

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
L

Larry Rekow

File should read Field
+++++++++++++++++++++++++++++++
Many thanks for your response.

My first instinct was to use an auto number id...however....when i
first tried this....i create several "test" records to make sure it
worked. then when i was satisfied it worked, i went back and deleted
these records. but to my chagrin, the 'real' records created after
this did continue the sequence. deleted id numbers were not replaced.
any way around this behavior?? also, if someone were to make a new
record and want to delete it for whatever reason, the id can never be
used again. the people i'm developing this app for don't want holes
in their numbering sequence.

oh, also, i'm using Access as the d/b

thanks.

L

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
T

Thomas A. Rowe

Larry,

Does your client want unique IDs?

If they always want unique ID, then once a ID is assigned, it can't be
re-use.

Unique ID will also allow data to be stored in other table related to the
specific ID, however if the ID where to be re-used, then you may have a
security issue where people or seeing other peoples data, of course this all
depends on the type of data being stored, etc.

To clear the database, you must delete all records in the table, then Tools
| Database | Compact and Repair will then reset the counter to 1. If there
is a record, then the count will not be re-set.
--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
L

Larry Rekow

Larry,

Does your client want unique IDs?

If they always want unique ID, then once a ID is assigned, it can't be
re-use.

Unique ID will also allow data to be stored in other table related to the
specific ID, however if the ID where to be re-used, then you may have a
security issue where people or seeing other peoples data, of course this all
depends on the type of data being stored, etc.

To clear the database, you must delete all records in the table, then Tools
| Database | Compact and Repair will then reset the counter to 1. If there
is a record, then the count will not be re-set.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I definitely don't want to use an autonumbered ID field as the file
number for the records. since i may in the future need to relate this
table to others easily, i will probably add an autonumbered id field
and make it the primary key.

but for now, i want to have a form that will
1. let users enter data for a new file, and
2. during or just before inserting this new row to the db,
query the db for the max number in it and use the max number +1
for the filenumber field. if in the future, someone ends up deleting
an older number, that's ok, i can live with the occasional gap. but i
want sequential numbering for the filenumber field.

what i've tried so far is to make drw query page that asks for and
displays the highest (max(filenumber)+1 or somesuch). then the user
clicks on it as a hyperlink which passes it as the default value for
the filenumber field on a form that uses the drw bot to create a new
record and show the confirmation page.

problem is, after one user is typing in a form, having picked, say,
number 45, another user selects the same number (45) before the first
user submits the form. the second person who tries to submit gets an
error, then things turn ugly.

so then i tried to make them save the number as soon as they picked it
and go right to a page where they can edit that number, but i can't
get the confirmation page to get the variable of the filenumber so it
can automatically open the edit form with the correct number.
otherwise, the user would have to look at the confirmation page, write
down or remember the new file number, and then go to a form where they
can enter the number in and it will search for and bring up that file
in a form where they can update the rest of the fields with the other
fields. gotta be a better way.

I've got my nose in an ASP 3.0 book i just bought hoping it will give
me an ASP answer.

thanks,

Larry

- - - - - - - - - - - - - - - - - -
"Forget it, Jake. It's Chinatown."
 
Top