473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Tarpping changes to a field

Hi

We have a set of complicated applications that access the same backend
database. One of the date fields if being blanked out from time to time by
an unknown process, which is causing problems in the organization as the
field is related to the payroll. Is there any way to place a check at table
level (kinda like sql triggers) to save the existing value of the field when
an app tries to modify it? This way at least we have a record of what got
changed and hopefully also when it got changed.

Thanks

Regards
Nov 13 '05 #1
3 1234
You could always put an afterupdate event in both the front end and the
back end databases...

The event would write the current username to a table (see
www.mvps.org/access) for some straightforward code to find the username
then write it to a table with a recordset add function with current
date and time.

I would suspect it is more likely that a rouge user is doing something
(possibly inadverantly) to amend the date field.

If it is an automatic process you need to debug your code to make sure
you have explicity added a line that is blanking the date when that
code is run...

Nov 13 '05 #2
Actually, here is the code from MVPS to help you out.

'******************** Code Start **************************
' This code was originally written by Dev Ashish.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.
'
' Code Courtesy of
' Dev Ashish
'
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If ( lngX > 0 ) Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = vbNullString
End If
End Function
'******************** Code End **************************
then create an afterupdate subroutine that does something like...

Sub writeusername()

dim username as string, db as database, rs as recordset

username = fOSUserName()

set db = currentdb()
set rs = nothing 'just in case
set rs = db.OpenRecordset("AuditTable")

rs.AddNew
rs![username] = username
rs![datetime] = date()+time()
rs.update

set rs = nothing
set db = nothing

end sub

Make sure you create a table in the back end (and link it to the front
end) that is called AuditTable and give it two fileds - 'username' and
'datetime'.

Enjoy...

Nov 13 '05 #3
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:43***********************@news-text.dial.pipex.com...
Hi

We have a set of complicated applications that access the same backend
database. One of the date fields if being blanked out from time to time by
an unknown process, which is causing problems in the organization as the
field is related to the payroll. Is there any way to place a check at
table level (kinda like sql triggers) to save the existing value of the
field when an app tries to modify it? This way at least we have a record
of what got changed and hopefully also when it got changed.

Thanks

Regards


No - there is nothing like triggers if the backend is an mdb. Obviously you
could design the table so that the date could not be null - ie no person or
process could 'blank it out' and you could could even ensure that the date
was between, say, Jan 1 2000 and Dec 31 2009.
If you really needed to make sure the field could not be altered, except
under very tightly controlled conditions, then you would have to use
user-level security and remove permissions from the table and write a piece
of code that logged on with a special account to do this. Then the only way
to do this would be to call a function like:
Public Function ChangeTheDate(dteNewDate As Date) As Boolean
The two problems with this are: firstly if other applications need to update
the table, then this may be too much work to change them all - and secondly
Access (Jet) security is breakble by anyone who wanted to break in. It
would be completely safe from any normal attempt to change the date (by any
person or process whatsoever), unless someone deliberately hacked the
security setup - and software to do this is widely available.
Perhaps you could migrate some or all the tables to SQL Server (or a free
version thereof). It would provide better security and triggers are built
in.
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JLuppens | last post by:
Does anyone know if there is a way to track changes in a text field like word does? I am using a SQL2000 database and can use either VB.Net or Access. The field is either ntext or Varchar. I...
4
by: Andy Hutchings | last post by:
Hi everybody - hope you can help out here. I have a form in a database, which is a columnar form from one of the tables in the db - there is a sub-form to the form which is a datasheet view of...
13
by: Peter | last post by:
Can anyone tell me how to change the data type of a field in a table created with a make table query? The field is a binary and must be changed to text. alternately does anyone know how to specify...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
4
by: Josh | last post by:
Hi, I am trying to write a function in a module in MS Access 2000 that will change the data type of a field called 'Start' in table 'bo_cpm_CS01ALL'. Here is the code that I have done so far...
2
by: Simon Harvey | last post by:
Hi all, Is there any easy way to check a field for calues that have changed on a post back. So the page is sent to the user, the user changes some values and I need to know which ones...
39
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
3
by: Pavkovich | last post by:
I have tried to set a date field when I put a checkmark in a yes/no field. In the date fields control source I put the following: IIf(=0," ",Date()) Unfortunately using Date() simply changes the...
2
by: William Cole | last post by:
Here is my issue I have two text fields (Field A, Field B). I want Field B to be updated when Field A is changed. The problem is Field A is being changed through JavaScript so an onChange event...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.