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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a single form to create 15 table entries?

Status
Not open for further replies.

markatos

Programmer
Feb 19, 2004
3
CA
Okay, here's the deal... I'm a newbie to Access, and can't wrap my head around this problem... This is my first database, and I was plugging along just fine until I came across this one...

I'm building a database to track Taxi Chits for the company I'm with...

Here's my structure, in a nutshell:
One user can have many taxi chit books assigned to him or her. Each book contains 15 chits with individual serial numbers.

I have three tables set up. Employees is the list of all company employees. BookAssign is the table containing the list of books each employee is assigned to. ChitAssign is the table containing the list of individual Taxi Chits assigned to each Book.

I have no problem creating a new Employee, nor assigning a book to a specific employee. The form for book assignment includes three pieces of data: The employee's name (selected from a list), the book number (a unique identifier for the book), and the serial number of the first chit in the book (the following fourteen increment by +1).

What I can't do, is populate the ChitAssign table with fifteen new chits as a book is assigned to a user.

Basically, I want each entry in ChitAssign to contain a Primary Key called ChitID, a serial number called ChitSerial (based on the serial number entered in the BookAssign table (+0, +1, +2, etc)), and a book number, culled from BookID in the BookAssign table.

Can anyone out there help me with the process I'd use to create 15 entries automatically?
 
To create 15 records, keep a table with 15 records and insert it each time you want to create a new set.

What is interesting is maybe you are carrying the physical model too literally across into your computer system. Are there separate physical (pre-printed?) books or does your system print a new book when you assign one, or are the books now purely conceptual ie pages on your system?

In other words why are you generating 15 records in advance rather than when they are actually used for (presumably) trips?

Do the numbers need to be in sequences, now you have a computer system?


 
Yes, there are physical books that are pre-printed. This software is going to be an audit/tracking software. The next step in the process, after book assignment will be to have the user log into the database and input the details of each chit (as it is used), for future audit against an invoice from the taxi company. I want to create the fifteen records at the time of book generation so that the user can select a chit number from a drop-down list...

BNPMike, can you explain a little further your idea of inserting a table with fifteen records? How do I go about doing that, and, secondly, how do I ensure that each of the fifteen records captures ChitSerialNumber correctly?
 
If you have a table of 15 (maybe 14) empty records, containing ony te minimum data, you can generate an append query to load your real table. If you are using an autonumber field to generate the sequential numbers the new records will acquire incrementing keys automatically - providing you seed them properly.

I must however admit I'd rather not create empty records. Once you store a book against a user, your system knows they must have access to 15 serial numbers. It can then offer the next empty one each time the user begins an entry dialogue. I doubt users would use serial numbers out of sequence.

 
Actually, with sub-assignments, where a manager gives a single chit to an employee, out-of-sequence completion is a possibility that must be taken into consideration. Thanks for the help, it's much appreciated. I will try the empty table method, and go from there.

Peace,
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top