By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,061 Members | 1,523 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,061 IT Pros & Developers. It's quick & easy.

Comparing fields

P: n/a
Greetings,
I have a simple html/asp form that submits data to an access DB. The
idea is
when calling a record back from the db, the page will have an option to

change certain fields (drop down) then a new submit option.
My question at this point would be what logic or commands would I use
to compare the original data in the fields to what's being submitted. I

ultimately want to preserve the original records and somehow append
data that changes only. I'll need to eventually call a record and see
all the changes/updates made.
Someone mentioned I would prob need a couple of tables with a link
(relationship) but is it possible to dynamically create fields as
changes are made?

Thanks in advance,

Oct 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

Hi,

Just wanna make sure i got the question before i write you the code.
Do you want to compare the old record with the new one by each letter
or character in the field
for example:
Field1(OLD): Hello
Text to add to Field1: Heeey

the result: last three characters are diffrent

is this what you are looking for??
Best Regards
Firas S Assaad
On Oct 24, 7:47 am, b...@hotmail.com wrote:
Greetings,
I have a simple html/asp form that submits data to an access DB. The
idea is
when calling a record back from the db, the page will have an option to

change certain fields (drop down) then a new submit option.
My question at this point would be what logic or commands would I use
to compare the original data in the fields to what's being submitted. I

ultimately want to preserve the original records and somehow append
data that changes only. I'll need to eventually call a record and see
all the changes/updates made.
Someone mentioned I would prob need a couple of tables with a link
(relationship) but is it possible to dynamically create fields as
changes are made?

Thanks in advance,
Oct 24 '06 #2

P: n/a
Hi,
It would search the current field and check for an exact match (letter
by letter with no case sensative). If it finds a match then it won't
write anything to the DB otherwise it will write the new information in
the DB.

Thanks,

Firas S Assaad wrote:
Hi,

Just wanna make sure i got the question before i write you the code.
Do you want to compare the old record with the new one by each letter
or character in the field
for example:
Field1(OLD): Hello
Text to add to Field1: Heeey

the result: last three characters are diffrent

is this what you are looking for??
Best Regards
Firas S Assaad
On Oct 24, 7:47 am, b...@hotmail.com wrote:
Greetings,
I have a simple html/asp form that submits data to an access DB. The
idea is
when calling a record back from the db, the page will have an option to

change certain fields (drop down) then a new submit option.
My question at this point would be what logic or commands would I use
to compare the original data in the fields to what's being submitted. I

ultimately want to preserve the original records and somehow append
data that changes only. I'll need to eventually call a record and see
all the changes/updates made.
Someone mentioned I would prob need a couple of tables with a link
(relationship) but is it possible to dynamically create fields as
changes are made?

Thanks in advance,
Oct 25 '06 #3

P: n/a

<bv***@hotmail.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Greetings,
I have a simple html/asp form that submits data to an access DB. The
idea is
when calling a record back from the db, the page will have an option to

change certain fields (drop down) then a new submit option.
My question at this point would be what logic or commands would I use
to compare the original data in the fields to what's being submitted. I

ultimately want to preserve the original records and somehow append
data that changes only. I'll need to eventually call a record and see
all the changes/updates made.
Someone mentioned I would prob need a couple of tables with a link
(relationship) but is it possible to dynamically create fields as
changes are made?
No. How many fields would be changing in a single post?

Here are two choices:-

1).

Have a second table which is identical to the first except it has version
number field added to the primary key include a version number on the
original table but do not add it to the primary key. After an update
happens on the table (the version number is incremented as part of the
update) make an insert to second table verbatim from the row that was just
updated. It's simple and effective but can make the DB large due to some
duplication of field values that have not changed, which in Access may be a
concern.

2).

Another choice is to have second table which includes the same fields that
make up the PK of the original table and adds a version number to them which
is also included in the original table. This table has a FieldName column
to contain the name of a field that is changing. It also has a value column
which contains a string that represents the value of the field for the
version.

When an update occurs allocate the next version number for the record to be
updates. Then compare the string version value of the each field being
updated with the incoming changes, if different insert a new record to the
second table with the PK of the record being updated, the new version
number, the field name and the new string value. After all the changes have
been logged make the update itself.

This approach suffers from complexity and results in values being stored as
strings rather than their native types. Also the more fields that change
per update the more duplication of PK and version number there will be.
That combined with using a string to represent data which is often smaller
in it's native type may mean this approach will also bloat your DB.
If you do use any of these approaches use a transaction to make the updates
atomic.
I prefer (and have used albeit in SQL Server) approach 1.

Thanks in advance,

Oct 26 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.