Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generating the same autonumber in multiple tables 1

Status
Not open for further replies.

fastfirebird

Programmer
Nov 17, 2000
17
CA
HERE IS THE SITUATION
- I have created a database which has several tables in it.
- I have also created a front end, to this database for the web, where users can fill in information for this database using a single online form.
- This form submits the information into SEVERAL DIFFERENT tables within the database.

-PROBLEM-
When all of this info is then put in the database in the 7 different tables, I have no way of knowing which entry corresponds with which. I need to have the database store the same ID number with each table entry, so that I know which entry corresponds with the other tables entries.

If you have any problems understanding this, feel free to ask any questions.

ANY HELP AT ALL IS APPRECIATED...

Thank you
Clark
 
You (need to) have only ONE autonumber. For all other 'uses' of this record, the "Autonumber" field is a simple "Lon Integer". After the first table/record is added, read it's (true) autonumber filed. Use this for the Long Integer field (Foregin Key) in the remaining tables.

MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
This will be for the web, and i would like to contain all of this on one form. Will I need to have the first tabel (the one with autonumber) filled out first, and then have the usere advance to another form, that would then read the latest autonumber ?
 
That is 'more-or-less" the approach.

If you are 'validating' the user input, you could generate the "AutoNumber" at any point after the validation - even if the record is not saved. Once the value is generated, it could be passed to other 'forms' and included (even as a visible, but not editable) item of information.

While there are numerous ways to cary the "AutoNumber" through a process, I would NOT recommend re-reading the value from the 'latest autonumber'. In busy systems, the "latest autonumber" may change frequently. Your app may have several users filling out information more-or-less concurrently.

MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
What categories of tables is the info going into?

Its seems to me that the front info should go into one table, and the other tables would be "looking up" the main table.

If Im understanding your problem, maybe your "tables" should actually be queries that you're making from table information.

The unique ID # will tie all records together.
 
SITUATION:

I need two autonumbers! I need one to identify the document number (primary key), and another that would be assigned automatically to the type of document.

For example:

Document 1 is: a) red b) green c) yellow

If I choose a), this will be the third "red" document, therefore it (the document) will be designated 005-003 (the fifth document entered; and the third red document).

I know that Access won't allow me to put two autonumbers in one table, any suggestions?
 
Well, it's a stretch, but I've written a FAQ on Custom Autonumbers. See the FAQ area for this forum. It isn't EXACTLY what you want, but since it is free - in source code - you can modify it to suit your desires. If you don't quite understand parts, please feel free to re-post, or the contact me directly. It was written for Ms. Access '97, and there may be soume small issues w/ later version(s).



MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top