After Data Entry, pulling wrong record (1 Viewer)

tabitha

Registered User.
Local time
Today, 06:09
Joined
Apr 24, 2015
Messages
62
I have a SQLExpress 2014 back end and an Access 2013 front end, and up until today, I have been able to have one form that is set to data entry, with two subforms that are not set to data entry, then a duplicate main form that's not set to data entry that uses the same two subforms to view existing records.

Normally, the "Add New" form is blank except for the FirstName and LastName boxes, then in both of their After Update events, it's set to refresh, and the Address subform and Info subform appear, and I can enter data for the new person.

Now today, when I enter a new FirstName, it refreshes and pulls all the info in for an existing record! I can't get it to stay on the record that was just created. Both following triggers are firing correctly (they create records on the Address and Info tables that inputs the correct ID for the parent table, and all queries are pulling the correct relationships and data), so I'm super baffled as to why suddenly data entry doesn't stay on the record it just created. I can't even tab over to write the last night before it pulls the records for a completely different person.

Yesterday, I did create a new Audit trigger that tracks all changes on all the tables in the database, and adds them to a new Audit table, but I don't see how this could've had any effect.
 

Rx_

Nothing In Moderation
Local time
Today, 07:09
Joined
Oct 22, 2009
Messages
2,803
Summary: So it worked, then behaved differently.
This is why I keep a copy of each version released (and sometimes code between releases)
Do you have a copy of your front-end from say a month before?
Does the older version do the same thing?
- if No - Then what did you change. It could be a property on a form e.g. a yes/no but you accidently pressed the space bar and didn't realized it changed.
- if Yes - Then an Office update may have altered the results.
- if Yes - Then a trigger or View on SQL could have been altered

- if No - comment out the code / events for the new Audit table - did that change the outcome?
 

tabitha

Registered User.
Local time
Today, 06:09
Joined
Apr 24, 2015
Messages
62
I've attached a few screenshots showing the symptom on Access. I know it's a server side issue because I opened an old copy of the Access front end and the same thing happened.

So what I did was I had the main Insured table, and an InsuredDates table, that, using a trigger, would create a record with a coordinating ID with the date of creation, and every time the record was updated, it would update the datetime and the user who made the change. Well we wanted something more descriptive, which kept a history of all changes, the datetime, and the users (instead of just the most recent). I found a script that you would run once, it created an Audit table, and created a trigger for every single table in the whole database, and every and all updates where recorded exactly how we wanted. I tested it creating new Insured records and updating and deleting, and it was perfect.

We didn't need redundant information (an Audit table with all changes, and a Dates table that was being updated), so I deleted the Update table and the two "Create" and "Update" triggers for the Insured table.

Then I was trying to compile this data into a user friendly report, and it was going super slow, so I ran the "Analyze Performance" tool and it suggested putting indexes on the FK field that other tables that have a relationship with the Insured table. As in, I have PK of ID on the Insured table, and InsID as a FK on the InsuredAddress table. So I created an index.

Next I knew, I tried to enter a new person, and the data entry form is pulling an already existing record! I tried deleting the indexes, but that didn't have any effect. I don't know how on earth creating an index for a FK could make it pull a different record. Is there something behind the scenes that I don't know about indexes on an SQL Server that can go wonky?
 

Attachments

  • wrong data entry record.jpg
    wrong data entry record.jpg
    96 KB · Views: 127

tabitha

Registered User.
Local time
Today, 06:09
Joined
Apr 24, 2015
Messages
62
Okay, I just realized the same thing is happening for the Beneficiaries. I go to type a first name, it does, and it fills in the InsID with the correct ID. However, as soon as I click to the next record, it pulls an already existing Beneficiary record. And this form is a Continuous Form, not a Data Entry, so I can see the previous entries above the blank one at the bottom.

Anyone have any idea how or why a form would pull an incorrect record when the relationships are all correct?
 

Users who are viewing this thread

Top Bottom