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

OldValue usage

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
1 1536
TheSmileyCoder
2,322 Expert Mod 2GB
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.
Assumptions:
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

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

Similar topics

2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
1
by: Andi Plotsky | last post by:
I am running some code to validate the entry made into a form called NumberOfSamples. If validation fails, then I want to revert back to the old value. I keep getting an error msg that says: ...
0
by: Bob Darlington | last post by:
I'm using the following code, which is called from the BeforeUpdate event in a form based on 'Tenant Details', to check for changes or additions to a series of dates, and if changed, to edit...
5
by: Dugo | last post by:
In Access 2003, I have a form (continuous form view) with several text boxes. The text boxes are not bound to a table since the layout of the form differs greatly from the structure of the...
1
by: gazelle04 | last post by:
I have these on BeforeUpdate event of a control If Me.txtAddress.Value <> Me.txtAddress.OldValue Then Me.txtGenInfo_UpdatedOn = Now Me.txtGenInfo_UpdatedBy = fOSUserName ...
3
by: Sirisha | last post by:
I am using the following code to get the CPU usage PerformanceCounter myCounter; myCounter = new PerformanceCounter(); myCounter.CategoryName = "Processor"; myCounter.CounterName = "%...
2
by: Keith Wilby | last post by:
In A2k3 is it possible to determine if the OldValue property for a check box exists using code? Thanks. Keith.
1
by: DaAdmin | last post by:
I am making a Cancel button to close a form without saving. I check for changes in each control and if it changed I want to restore it to the old value, I get an error saying I can't assign value to...
8
by: Avi | last post by:
Hi all, I'm using string Replace(string oldValue, string newValue) and would like it to replace only full words that matches oldValue and not when oldValue is a substring of a larger word. ...
1
by: Allen Browne | last post by:
Testing if the new value is different from the old one avoids giving the message in these cases: a) It's a new record (so there was no old value.) b) No customer was specified previously (so the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.