473,441 Members | 2,075 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,441 software developers and data experts.

Form data entry history

Hi

I am using the following code to save the changes to a form's data in the
form's Before Update event;

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.OldValue <> ctl.Value Then
st = st & ctl.Name & "=" & ctl.Value & vbCrLf & vbCrLf
End If
End If
Next ctl

If st <> "" Then
' Save st in a table
End If

The problem is that this code does not always work and save the changes on
some of the fields particularly the ones which are memo. Any reason why this
does not always work?

Thanks

Regards
Nov 30 '05 #1
3 1727
i don't have any suggestions as to why your code does not work consistently.
but if nobody else is able to help you solve the issue, i can offer an
alternative suggestion: take a look at MVP Allen Browne's instructions for
creating an Audit Log, at http://allenbrowne.com/AppAudit.html
i've implemented the setup in a couple databases, and it works very nicely.

hth
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I am using the following code to save the changes to a form's data in the
form's Before Update event;

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.OldValue <> ctl.Value Then
st = st & ctl.Name & "=" & ctl.Value & vbCrLf & vbCrLf
End If
End If
Next ctl

If st <> "" Then
' Save st in a table
End If

The problem is that this code does not always work and save the changes on
some of the fields particularly the ones which are memo. Any reason why this does not always work?

Thanks

Regards

Nov 30 '05 #2
Its bit complicated for my meagre requirements. What I have discovered after
tracing the code is that the expression ctl.OldValue <> ctl.Value returns
null (instead of true or false) if ctl.OldValue has a value and ctl.Value is
null.

Here is an example from command window;

? ctl.OldValue
76577687

? ctl.Value
Null

? (ctl.OldValue <> ctl.Value)
Null

Is this a bug with access 2000 sp3?

Thanks

Regards
"tina" <no****@address.com> wrote in message
news:Sq********************@bgtnsc04-news.ops.worldnet.att.net...
i don't have any suggestions as to why your code does not work
consistently.
but if nobody else is able to help you solve the issue, i can offer an
alternative suggestion: take a look at MVP Allen Browne's instructions
for
creating an Audit Log, at http://allenbrowne.com/AppAudit.html
i've implemented the setup in a couple databases, and it works very
nicely.

hth
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I am using the following code to save the changes to a form's data in the
form's Before Update event;

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.OldValue <> ctl.Value Then
st = st & ctl.Name & "=" & ctl.Value & vbCrLf & vbCrLf
End If
End If
Next ctl

If st <> "" Then
' Save st in a table
End If

The problem is that this code does not always work and save the changes
on
some of the fields particularly the ones which are memo. Any reason why

this
does not always work?

Thanks

Regards


Nov 30 '05 #3

"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:lt******************************@pipex.net...
Its bit complicated for my meagre requirements. What I have discovered after tracing the code is that the expression ctl.OldValue <> ctl.Value returns
null (instead of true or false) if ctl.OldValue has a value and ctl.Value is null.

Here is an example from command window;

? ctl.OldValue
76577687

? ctl.Value
Null

? (ctl.OldValue <> ctl.Value)
Null

Is this a bug with access 2000 sp3?
No, this is no bug. A null has no value and cannot be compared to a value.
Any null compared to anything will always be null. You could use:

?(ctl.OldValue <> Nz(ctl.Value, 0)

Or

? Nz(ctl.OldValue <> ctl.Value, 0)

which would be 0 (false) if either value (or both) were null)

HTH,
Randy

Thanks

Regards
"tina" <no****@address.com> wrote in message
news:Sq********************@bgtnsc04-news.ops.worldnet.att.net...
i don't have any suggestions as to why your code does not work
consistently.
but if nobody else is able to help you solve the issue, i can offer an
alternative suggestion: take a look at MVP Allen Browne's instructions
for
creating an Audit Log, at http://allenbrowne.com/AppAudit.html
i've implemented the setup in a couple databases, and it works very
nicely.

hth
"John" <Jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi

I am using the following code to save the changes to a form's data in the form's Before Update event;

For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If ctl.OldValue <> ctl.Value Then
st = st & ctl.Name & "=" & ctl.Value & vbCrLf & vbCrLf
End If
End If
Next ctl

If st <> "" Then
' Save st in a table
End If

The problem is that this code does not always work and save the changes
on
some of the fields particularly the ones which are memo. Any reason why

this
does not always work?

Thanks

Regards




Nov 30 '05 #4

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

Similar topics

1
by: Aravind | last post by:
Hi folks. My database project has the following: -------------------------------------------------------------------------------- tables: Member: MemName, MemNo , MemType, CourseFaculty...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
1
by: KC | last post by:
I am using Access 2002, with a database template from MS Office. The Orders Management Database. I have tweaked this for use with our company. It is a small database with close to a 1000 records...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
6
by: allyn44 | last post by:
HI--what I am trying to do is 2 things: 1. Open a form in either data entry mode or edit mode depending on what task the user is performing 2. Cancel events tied to fields on the form if I am in...
8
by: Martin | last post by:
I hope not, but, I think the answer to this question is "it can't be done". Northwind sample database. Orders form. Go to a new record. Select a customer in "Bill To:" Don't enter any...
6
by: Jack | last post by:
Hi, I have an Access application which need to be converted to asp-sql server application. This Access application uses a single form. This form has got a SS number with names and age. The form...
3
by: feeman | last post by:
What I am looking at doing is I have a couple of forms, when I enter the number of products been despatched on the order form, it then creates a record in the transaction table and also the product...
1
by: kickergirl | last post by:
I have a database developed in MS Access 2000 that allows people to enter training histories for staff. The staff information is stored in tblStaff, and the training histories are stored in...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.