duplicate PK values help

usmc-ratman

Registered User.
Local time
Today, 16:58
Joined
May 27, 2005
Messages
20
Need assistance quickly.... please
Have a main table with client personal information (name, dob, address, etc), then 5 additional tables (file notes, charting, billing, etc) that are linked to that main client table.
The main table (named "clients") has a PK set that is autonumber, no duplicates, unique. The linked tables all have PK's set, that are also autonumber, no duplicates, unique; and then a linking field to link it to the clients table. There is a main clients form, with 6 tabs, each tab contains a subform for each of the linked tables.
There are 13 users on the system, and all 13 are usually using the database throughout the day. The database is split between frontend / backend, with the BE residing on a shared 1TB network server drive.
Recently, they are getting the error (when entering in the billing tab) that "the record cannot be created because it would create a duplicate in an index field" or something similar to that. I assume this is happening because two or more users are entering billing information at the same tab, but never in the same clients record, just entering data into the same table at roughly the same time.
How can I stop this from happening, short of creating an independant popup form for the billing.
I have tried to figure out a way to have the subform "hold" the new entry until they tab through the record completing the record information, and then adding it into the billing table, but as of yet havent figured out how to do that. Something to do with an INSERT INTO command...
Thanks,
JR
 
HiTechCoach - Thanks for responding... The query "behind" the subforms are all just simple queries. By that I mean that I created a query for the table "billing", and then set that as the record source for the subform "billinginfo". Then ran the subform "wizard" and told it to display information for the linked fields.
Dont know if this is considered an "append" query or not. It does allow entries, just sometimes (frequently lately) it gives the error... And today, some ppl stated that some of the entries were not there at all that they had added earlier in the day.
 
Helo usmc!
Look at "DemoNewNumA2000.mdb" (attachment, zip).
Open form and see.
 

Attachments

MStef: Will download and take a look at it, then post back...
Thank you very much,
JR
 
MStef - Looks like this will work, I will put this solution into the database tonight and see what happens through the day tomorrow. If they don't IM me, then I'll know that your solution was as good as GOLD.
I had a throught that is similar to your solution, just not as magical :), i thought about changing the PK to a text field (since there will not be a number constraint that could cause it to error out) and make the default value the date/time (ie: =format(now(),"mmddyyhhmmss"). I've tested this, and it gives a unique number value, and the users would have to be going to enter a billing record at exactly the same second, which isnt impossible, but less likely than not.
Anyway, I'm implementing your solution, and see what happens... Thank you very much!
JR
 
HiTechCoach: Thanks for the heads-up... I will study the information. For the time being I'm going to try the code behind the form by MStef, and see if that gets me through a full day without getting IM's that they are getting ready to shoot their computers.... :confused:
Will post back the results...
Respectfully submitted,
JR
 
dont change your PK to text instead of a numnber. youll get the same problems, but much less efficiently.

although you have an autonumber, you can still write/append a value to it, instead of letting access add the number automatically.

does your append query try to add a specific value to the id field. if so, thats probably where the duplicates are coming from.
 
Hey all - just posting a quick update to the thread.
The suggestion by MStef is working great, I will add this to my arsenal. However, and unfortunately, the whole database has been corrupted so badly that I am just going to have to start back from scratch, and make a completely new db.
I originally made this over 5 years ago, and over that time, they asked me to implement many changes. things were great until the storms came through in July and thrashed their server, completely corrupting the data in there somewhere.
The two other db's that are fed the main client list off this one are fine, so hopefully they will continue to perform.
Thank you all for your assistance and knowledge.
Have a great weekend

JR
 
Hello usmc!
My congratulations, have a great weekend, too.
 

Users who are viewing this thread

Back
Top Bottom