473,803 Members | 3,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compare part of 1 field with another field in access

Hi,

I am atempting to compare part of a field with the whole of another
field in access. Is this possible?

Basically I have 2 tables with the following info:

Table1
Field1 = MR.

Table2
Filed1 = MR

I want to be able to check whether the field in Table1 contains a
trailing fullstop, if it does i want ot remove it and then compare, if
it doesnt i simply want to compare to Table2 field.

Can this be done in the QBE window

Thanks

Nov 13 '05 #1
9 5604
In the 18 hours between your first post on this subject and this re-post,
did you not have any success with the 2 suggestions which were kindly
offered by others? At least do those posters the courtesy of trying their
suggestions first.
Nov 13 '05 #2
Thank you for your lovely reply - surprisingly, I have already tried
the posts previous suggestions - but I will most certainly try again
now that you have nicely pointed this out!

Thank you once again for letting me know, ever so pleasantly - people
do make mistakes Mike, not everyone is as perfect and pedantic as you!!

Nov 13 '05 #3
<ge*********@ho tmail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Thank you for your lovely reply
You're most welcome
- surprisingly, I have already tried
the posts previous suggestions
but it didn't work?
- but I will most certainly try again
now that you have nicely pointed this out!

Thank you once again for letting me know, ever so pleasantly
I'm glad you appreciate my pleasantness
- people
do make mistakes Mike, not everyone is as perfect and pedantic as you!!


You're too kind. Many people are a great deal more perfecter than me.
Nov 13 '05 #4
ge*********@hot mail.com wrote in news:1115799878 .387838.171900
@o13g2000cwo.go oglegroups.com:
Hi,

I am atempting to compare part of a field with the whole of another
field in access. Is this possible?

Basically I have 2 tables with the following info:

Table1
Field1 = MR.

Table2
Filed1 = MR

I want to be able to check whether the field in Table1 contains a
trailing fullstop, if it does i want ot remove it and then compare, if
it doesnt i simply want to compare to Table2 field.

Can this be done in the QBE window


Yes. This is a trivial problem but the solution depends upon information
you have not provided.

Are you using JET? If you don't know then answer is, "Yes".

Assuming "Yes":

Are you using a recent version of Access (>=2002 I believe) which will
allow you to use the VBA Replace function in queries? If not we may have to
write a UDF to remove the ".".

Must the "." stay in Table1, Field1, or may we just run an update query to
remove it and do our comparison later?

Are you comparing each of the rows in Table1 with each of the rows in
Table2?
If not how are you mapping the rows so that each row in Table1 is compared
with the appropriate row in Table2?

BTW. Two tables with the same data is almost always a bad idea. Just one of
the reasons is that it's difficult to keep the data in both tables up-to-
date.

--
Lyle

"The aim of those who try to control thought is always the same. They find
one single explanation of the world, one system of thought and action that
will (they believe) cover everything; and then they try to impose that on
all thinking people."
- Gilbert Highet
Nov 13 '05 #5

Mike MacSween wrote:
<ge*********@ho tmail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Thank you for your lovely reply
You're most welcome
- surprisingly, I have already tried
the posts previous suggestions


but it didn't work?
- but I will most certainly try again
now that you have nicely pointed this out!

Thank you once again for letting me know, ever so pleasantly


I'm glad you appreciate my pleasantness
- people
do make mistakes Mike, not everyone is as perfect and pedantic as

you!!
You're too kind. Many people are a great deal more perfecter than me.


Bless! Learn to spell!!

Nov 13 '05 #6
Yes, using JET (cos i didnt know the answer)

Unfortunatley, I am using Access 2000 so I cannot use the Replace
function.

We can use an update query to remove the "." and compare later as the
dot does not have to remain in Table1 (if present at all not all
records contain a dot - 80% records have trailing dot)
Idealy I'd like to remove the dot and then compare (as if the dot was
never there)

Linking the tables via another field - NINO (primary key)

The 2 tables do not have the exact same fields (similar tho) I am
trying to compare other fields as well as TITLE for Data Integrity
reasons - I've imported the files into Access

Thankyou

Nov 13 '05 #7
I can't see the rest of this thread, so I don't know everything that's
transpired so far, but you can use Replace in Access 2000. If you haven't
applied all of the service packs, you may have to write your own function
that calls Replace and use it instead. Something like:

Function MyReplace(Expre ssion As String, _
Find As String, _
Replace As String, _
Optional Start As Long = 1, _
Optional Count As Long = -1, _
Optional Compare As Long = 0) As String

MyReplace = Replace(Express ion, Find, Replace, _
Start, Count, Compare)

End Function

If you know you're not going to be using the Start, Count or Compare
parameters, you can leave them out.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<ge*********@ho tmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Yes, using JET (cos i didnt know the answer)

Unfortunatley, I am using Access 2000 so I cannot use the Replace
function.

We can use an update query to remove the "." and compare later as the
dot does not have to remain in Table1 (if present at all not all
records contain a dot - 80% records have trailing dot)
Idealy I'd like to remove the dot and then compare (as if the dot was
never there)

Linking the tables via another field - NINO (primary key)

The 2 tables do not have the exact same fields (similar tho) I am
trying to compare other fields as well as TITLE for Data Integrity
reasons - I've imported the files into Access

Thankyou

Nov 13 '05 #8
ge*********@hot mail.com wrote:
Yes, using JET (cos i didnt know the answer)

Unfortunatley, I am using Access 2000 so I cannot use the Replace
function.

We can use an update query to remove the "." and compare later as the
dot does not have to remain in Table1 (if present at all not all
records contain a dot - 80% records have trailing dot)
Idealy I'd like to remove the dot and then compare (as if the dot was
never there)

Linking the tables via another field - NINO (primary key)

The 2 tables do not have the exact same fields (similar tho) I am
trying to compare other fields as well as TITLE for Data Integrity
reasons - I've imported the files into Access

Thankyou


In Access 2000, I believe we can use the replace function in a wrapper,
SQLRemove, as below.
I ran the function RemoveThePeriod s successfully.

<warning style="color:re d;font-size:x-large;font-weight:bold">

1. I have not removed the reference to ADO;
2. I created a safety copy of my table first;
3. I used names for the table and fields which are match the table I
want to modify.
4. I checked the code to remove any extraneous line breaks my newsreader
might have inserted.

</warning>

Public Function SQLRemove(ByVal vName As String, ByVal vChar As String)
As String
SQLRemove = Replace(vName, vChar, "")
End Function

Public Function RemoveThePeriod s()
CurrentProject. Connection.Exec ute ("UPDATE Schools SET SchoolName =
SQLRemove(Schoo lName,""."")")
End Function

--
--
Lyle

"The aim of those who try to control thought is always the same. They
find one single explanation of the world, one system of thought and
action that will (they believe) cover everything; and then they try to
impose that on all thinking people."
- Gilbert Highet
Nov 13 '05 #9
Brilliant - many thanks!

Nov 13 '05 #10

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

Similar topics

1
1969
by: Simon Gare | last post by:
Hi I need to compare a dynamic field in an asp page to a field in another table, if there is no match then i would like to chane the row colour ( see code below). The problem Im having is that the comparison should be one of many entries in that db field, at the moment it only compares the first field in the db. Please Help
5
10883
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 new database. For instance, her old database has a table with Band Info in it. Her new database also has a table with Band Info in it but slightly different. I was wondering if there was an easy way to compare the fields from similar tables in...
2
2300
by: Megan | last post by:
Hi everybody- I have 2 tables, Hearings and Rulings. Both have primary keys called, CaseID, that are autonumbers. I don't want both tables to have the same autonumber. For example, if Hearings has 55, then I want Rulings to have a number greater than 55. Two or more Hearings may be entered before a Ruling is entered. For example, Hearings with CaseIDs= 55, 56, and 57 may be entered before a Ruling or vice versa. There is no definite...
3
3173
by: ChadDiesel | last post by:
Hello everyone. I need some advice on table structure for a new project I've been given. One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone formats the spreadsheet, prints it out, and manually picks out the products we need to ship. I want to import this into an Access table. Basically, the sheet with some data examples looks something like this: ...
6
2403
by: geronimo_me | last post by:
Hi, I'm trying to compare two TITLE fields from different tables to locate anomolies - however Table1 TITLE field contains a dot(.) after some of the entries, however i want to remove the dot so i can compare properly (the dot is irrelavant to my comparisons): Record1 Table1 TITLE = MISS. Table2 TITLE = MISS
5
2674
by: Edd E | last post by:
Hi, I have a database to store my analyses (Access 2002, WinXp), the basic structure is: TABLE 1 = Sample Info TABLE 2 = Analysis type 1 TABLE 3 = Analysis type 2 TABLE 4 = Analysis type 3 ....where each table stores results of a different type of analysis
1
1926
by: olle | last post by:
hi I have a real problems with comparering date in asp and sqlserver In sqlserver I have a table tblDates with the field dtmDate the field dtmDate in a sqlserver table may contain a date like 2005-07-30 08:46:54.000 (it was eported from Access) and then in asp I want to create a date like: DIM MYDATE
6
7723
by: napatel04 | last post by:
Hi everyone, I would like to know if there is a quick query someone can help me write for the following scenario. I think I can do this with VBA but since this is suppose to be a temp. solution, I really do not want to spend too much time on it. I have two tables, 1 an old one which has work done in it with all the necessary columns correctly populated with the data and the second one I need which has the same columns but need to be...
0
6225
by: Tony Hine | last post by:
Problem for Excel Developers One of the problems facing Excel developers moving into MS Access is actually the apparent similarity between MS Access tables and Excel spreadsheets. MS Access is NOT Excel This similarity of the “look” in both programs, the layout of the data, leads to the Excel developer mistakenly thinking that a database works in a similar way to a spreadsheet. Flat File Database Spreadsheets are very sophisticated...
0
9564
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10546
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10292
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6841
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.