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

Compare records

jpr
Hello,

Is there a way I can verify if an existing record (c/n) with a
different format type is present in another table?
My form has a SSN field with a text data type and a 13 characters
format (000-00-0000AA).
I need to verify via a cmdbutton is a record with a similar SSN exists
in table2. In table2 the SSN has a 9 character format. 123456789.
This is air code which I would need to change.

If Not IsNull(DLookup("[SSN]", "table2", "[SSN] = '" & Me![C/N] & "'"))

Then
MsgBox "Sorry! A record with this SSN is already in file"
Thank you.

Nov 7 '06 #1
4 1892
Assuming the format is always as you described, you can convert the 13
character value into the 9 character format and compare the result:

NewValue = Left([13Char],3) & Mid([13Char],5,2) & Mid([13Char],8,4)

If DCount("*","table2","[SSN]='" & NewValue & "'") 0 then ...
or if [SSN] in table2 is strictly numeric:
If DCount("*","table2","[SSN]=" & NewValue) 0

jpr wrote:
>Hello,

Is there a way I can verify if an existing record (c/n) with a
different format type is present in another table?
My form has a SSN field with a text data type and a 13 characters
format (000-00-0000AA).
I need to verify via a cmdbutton is a record with a similar SSN exists
in table2. In table2 the SSN has a 9 character format. 123456789.
This is air code which I would need to change.

If Not IsNull(DLookup("[SSN]", "table2", "[SSN] = '" & Me![C/N] & "'"))

Then
MsgBox "Sorry! A record with this SSN is already in file"

Thank you.
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

Nov 7 '06 #2
You need to put the [C/N] in the same format as the [SSN] in order to make
the comparison. Is the [SSN] a numeric or text field? Do you need help with
the function?

jpr wrote:
>Hello,

Is there a way I can verify if an existing record (c/n) with a
different format type is present in another table?
My form has a SSN field with a text data type and a 13 characters
format (000-00-0000AA).
I need to verify via a cmdbutton is a record with a similar SSN exists
in table2. In table2 the SSN has a 9 character format. 123456789.
This is air code which I would need to change.

If Not IsNull(DLookup("[SSN]", "table2", "[SSN] = '" & Me![C/N] & "'"))

Then
MsgBox "Sorry! A record with this SSN is already in file"

Thank you.
--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

Nov 7 '06 #3
jpr
Great Help. Thank you very much.
kingston via AccessMonster.com wrote:
Assuming the format is always as you described, you can convert the 13
character value into the 9 character format and compare the result:

NewValue = Left([13Char],3) & Mid([13Char],5,2) & Mid([13Char],8,4)

If DCount("*","table2","[SSN]='" & NewValue & "'") 0 then ...
or if [SSN] in table2 is strictly numeric:
If DCount("*","table2","[SSN]=" & NewValue) 0

jpr wrote:
Hello,

Is there a way I can verify if an existing record (c/n) with a
different format type is present in another table?
My form has a SSN field with a text data type and a 13 characters
format (000-00-0000AA).
I need to verify via a cmdbutton is a record with a similar SSN exists
in table2. In table2 the SSN has a 9 character format. 123456789.
This is air code which I would need to change.

If Not IsNull(DLookup("[SSN]", "table2", "[SSN] = '" & Me![C/N] & "'"))

Then
MsgBox "Sorry! A record with this SSN is already in file"

Thank you.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1
Nov 8 '06 #4

ruralguy via AccessMonster.com wrote:
You need to put the [C/N] in the same format as the [SSN] in order to make
the comparison. Is the [SSN] a numeric or text field? Do you need help with
the function?
SSN should be a text field, in spite of the fact that SSN's appear
numeric. The first set of numbers can have a leading zero, eg
"042-XX-XXXX" it just means that the holder was born in the 042
location (in this case Boston). So you should store this as text.
Also because it makes absolutely no sense to do math on this kind of
"number".

I'm not Kent Brockman, but that's my 2 cents...

Nov 8 '06 #5

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

Similar topics

3
by: Peter Phelps | last post by:
My problem is as follows: I need automatically iterate through a single field in a table and use the values in the field to create an in-statement. Currently, the character limitation in the...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
2
by: sleepyant | last post by:
Hi, I have 2 identical tables in each server that I need to compare and update/insert accordingly using SQL. For example, server A as a source and Server B as destination which both have Table1....
10
by: hibbii | last post by:
Could someone help me write a query or code that allows me to compare records based on the quarter? For example, in my table all the records have the PK set as (DCN & Quarter). The DCN is usually...
2
by: darrel | last post by:
HI there a newbie here in Visual Basic i just wanted to ask something, on how can compare records in a particular field in my table... I'am develop a time scheduling system, its like for example i...
1
by: darrel | last post by:
HI there a newbie here in i just wanted to ask something, on how can compare records in a particular field in my table... I'am develop a time scheduling system, its like for example i have a table...
5
by: lucianone41 | last post by:
Hello everyone, I´m starting to learn Access , SQL and a bit of VB. My problem is the following: I have two tables, one of them contains the records for missing points on a GPS system (called the...
5
by: binky | last post by:
Question for all you SQL gurus out there. I have a (seemingly) complex query to write, and since I'm just learning SQL server, am not sure how to go about it. Tables: t_trans t_account All...
13
by: Charlotte | last post by:
Hi, i've googeled to find a asp-script that can compare all the records in two different access databases the mdb's have exactly the same tables what i want is that (the output) all 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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: 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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.