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

OldValue usage

P: 2
I have a project wherein i have to take the CardID of an RFID as input. The problem i m facing is that I dont want the values of the cardid to be repeated so i want to have a case where the system compares the value of the new cardid and compare it with the previous value. If it is same, the new value should be discarded else it should be written in the database.
I tried using the OLDVALUE command but i was not sure of the syntax.

Kindly help me out.
Apr 23 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 100+
P: 2,321
The oldvalue is something you use when your changing a record. It can be used if you want to make comparisons between the original value and the new value, before you make a save. From what I understand thats not what you want.

It depends a bit on how you get this information (the CardID), but when you get it you can simply check if your table allready contains an entry for that cardID.
Cards are stored in tbl_Cards
cardID is a field in table tbl_Cards, and is unique.
When you get your CardID input, you temporarily store it in a long variable, lngCardID

You can then use:
Expand|Select|Wrap|Line Numbers
  1. If Dcount("*","tbl_Cards","CardID=" & lngCardID)>0 Then
  2.   'CardID allready exists, do whatever you want
  3. Else
  4.   'CardID is new, do whatever you want
  5. End If
Apr 23 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.