mloucel
Member
- Local time
- Yesterday, 22:13
- Joined
- Aug 5, 2020
- Messages
- 256
Following advise from Moderators..
Some code in my 1st Program is from @arnelgp whom I respect a lot.
I have attached a mock database, contains no valid information, but is similar to my final database.
I do understand that there are many possible programming errors but for what is worth it works for me, and I will clean it once I got all done.
-- My main issue right now:
- I want to create a LOG of actions done in the database, so I can keep a little track on somethings done, I am a rookie, so I search a lot for solutions that I can use and learn, I found a nice routine in youtube to:
1) Add a couple of records when a user adds a new record, date/time, the user name, the ID of the record and the word NEW
2) Will add as well when someone Edits a record, saving the old value and the new value [I hope], the ID, date/time, user name, and the control value before and after.
-- The problem
I followed instructions as specified in youtube but when my Module [LogFunctionModule] Function AuditChanges tries to save the data to the LogT [Log table] I got errors, I have changed the code a few times but I cannot figure out what is wrong, and I am barely trying the function on my ADD record routine.
My Logic:
On frmPatientCharts I added a routine on BeforeUpdate event, either is a NEW record or EDIT, [I WILL NOT DELETE records]
this calls the AuditChanges function
once called generates Error 3201: You cannot add or change a record because a related record is required in table 'Charts'
I Have no Idea why, table charts should not be in error since I am tying to save data to table LogT
I've changed a lot in the code, but I saved it as remark so that I know what was there before.
I have attached my database in hope someone can guide me in the right direction, thanks you all gurus for your help.
Some code in my 1st Program is from @arnelgp whom I respect a lot.
I have attached a mock database, contains no valid information, but is similar to my final database.
I do understand that there are many possible programming errors but for what is worth it works for me, and I will clean it once I got all done.
-- My main issue right now:
- I want to create a LOG of actions done in the database, so I can keep a little track on somethings done, I am a rookie, so I search a lot for solutions that I can use and learn, I found a nice routine in youtube to:
1) Add a couple of records when a user adds a new record, date/time, the user name, the ID of the record and the word NEW
2) Will add as well when someone Edits a record, saving the old value and the new value [I hope], the ID, date/time, user name, and the control value before and after.
-- The problem
I followed instructions as specified in youtube but when my Module [LogFunctionModule] Function AuditChanges tries to save the data to the LogT [Log table] I got errors, I have changed the code a few times but I cannot figure out what is wrong, and I am barely trying the function on my ADD record routine.
My Logic:
On frmPatientCharts I added a routine on BeforeUpdate event, either is a NEW record or EDIT, [I WILL NOT DELETE records]
this calls the AuditChanges function
once called generates Error 3201: You cannot add or change a record because a related record is required in table 'Charts'
I Have no Idea why, table charts should not be in error since I am tying to save data to table LogT
I've changed a lot in the code, but I saved it as remark so that I know what was there before.
I have attached my database in hope someone can guide me in the right direction, thanks you all gurus for your help.