UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Tracking New Record Info, Access 2013    
 
   
stevew295
post Jan 2 2018, 06:21 PM
Post#1



Posts: 76
Joined: 3-May 10



Users have mix of 2010, 2013, 2016

I have a subform (FileTable) where the AcctNumber is filled in automatically because of the parent/child relationship. The FileNumber is autogenerated and is the PK for the FileTable. I want to: as soon as a new record is created, copy (append) the AcctNumber & FileNumber into another tracking table. I assume would need

If Me.NewRecord then
'append the new data into tracking table
else
'don't
end if

on the on_current event of the subform. My question is: will the on_current catch the new FileNumber, or will it fire before the new FileNumber is autogenerated? Also, user can either just start a new File record or use a command button to start a new record and insert some data from the previous record. Should I be looking at some other method?

If you're wondering why I want to do this, I'm having some issues where a multi-user (each user has their own front-end) database is having a record deleted somehow from the FileTable. I've been looking for causes, and I'm sure I will need to ask more questions reference that, but for the short term I need a method to track which FileNumber has been deleted, so users can know which record to re-create.

Thanks, Steve
Go to the top of the page
 
Doug Steele
post Jan 2 2018, 07:02 PM
Post#2


UtterAccess VIP
Posts: 21,559
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Easiest way to know whether you'll get the newly generated Autonumber in the event is to write the code and see whether you do.

You could consider writing a Data Macro to do this.

--------------------
Go to the top of the page
 
tina t
post Jan 2 2018, 08:25 PM
Post#3



Posts: 5,223
Joined: 11-November 10
From: SoCal, USA


QUOTE
I'm having some issues where a multi-user (each user has their own front-end) database is having a record deleted somehow from the FileTable. I've been looking for causes

well, there are only two ways to delete a record from a table, AFAIK - either manually via the table or a query or a form, or by using VBA. either way, you have to specifically delete a record, it doesn't just happen. it's possible that a record could be created but not saved to the table, when you thought it would be.

if your tables are protected from direct access by the users, then you have total control of whether an existing record is deleted or not - via the options you provide the users in the user interface. you might consider not allowing any records to be deleted. i have a number of applications that don't allow record deletion, in support of the business rules. instead, a user may "delete" a record, which is actually flagged as deleted, or unavailable, usually by adding a date/time stamp to a specific field - and the record is then excluded from queries, forms and reports which the user sees, so from their point of view the record is deleted.

just some food for thought...

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
stevew295
post Jan 2 2018, 08:26 PM
Post#4



Posts: 76
Joined: 3-May 10



Thanks Doug. Sure, I can test it out using the "if new record...." VBA. I had a concern that when I tested, it would work, but if the record is deleted BEFORE the record is saved, then I'd never know, which is why I was wondering if this was the right approach. (for whatever reason, it seems to happen with new records more than existing records)

But, certainly I will test it.

Uhhmmm, can you elaborate on the "DATA Macro"? I have no idea what that means, is it a special macro?

Thank You.

Steve
This post has been edited by stevew295: Jan 2 2018, 08:31 PM
Go to the top of the page
 
stevew295
post Jan 2 2018, 08:30 PM
Post#5



Posts: 76
Joined: 3-May 10



Tina, I've already set the form to not allow deletions. I'm not sure whether to go into detail here, or in a new thread reference the Deletion problem.

But any and all "food for thought" is very welcome.

Thanks, Steve
Go to the top of the page
 
Doug Steele
post Jan 2 2018, 10:34 PM
Post#6


UtterAccess VIP
Posts: 21,559
Joined: 8-January 07
From: St. Catharines, ON (Canada)


See whether Create a Data Macro helps.

--------------------
Go to the top of the page
 
Larry Larsen
post Jan 3 2018, 05:43 AM
Post#7


UA Editor + Utterly Certified
Posts: 24,141
Joined: 26-August 02
From: Melton Mowbray,Leicestershire (U.K)


Hi Steve

I totally agree with Tina's suggestion with regards to "not" deleting records, I too have never allowed that data in my applications to be erased for a number of reasons..

Tractability / Historical / User Error... etc...

Why go to great lengths to getting your users to populate your database, then only to delete them... (data)

Record auditing also runs along side the process to capture record changes (details /who / when / what..)

You can also provide "archiving" old data into a safe place...

Keep what you've got, some day you may need to reference it... (audit's)

Regards
Larry
thumbup.gif

--------------------
"Time...We have exactly the same number of hours per day that were given to Helen Keller, Pasteur, Michaelangelo, Mother Teresa, Leonardo da Vinci, Thomas Jefferson, and Albert Einstein"
H. Jackson Brown
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    23rd January 2018 - 07:05 PM