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

Comparing Records In A Table

72
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 have a table name called RECORDS that has a 5 fields namely, TIME START, TIME END ,DAYS,ROOM. i want to compare all records that has been save in the RECORDS to be able to test if there a conflict on it,,, first hing i wanted to is to test if there equal values of records.

Example, the first record that has been saved has the follwing:
TIME START: 7:00 AM, TIME END 8:00 AM, DAYS: MWF, ROOM: 101.

then the second record that has been save is exactly equal to the first record.
the question how i can prevent this sql statement, what is advisable to use LIKE or COMPARE...

Can somebody tell me or site some ideas on how to solve this problem:

And lastly

am using this code:

Select * from RECORDS where TIME START, TIME END, DAYS, ROOM (this is the part i dont know).. i hope someone here can help me.

Thank you very much.... and God Bless...
May 23 '07 #1
2 1294
Killer42
8,435 Expert 8TB
Select * from RECORDS where TIME START, TIME END, DAYS, ROOM (this is the part i dont know).. i hope someone here can help me.
You said five fields - this is only four. Trying to trick us, huh? :)

I'd say what you need to do is plug the values you have to the query, something like this...

Select * from RECORDS where [TIME START] = www AND [TIME END] = xxx AND DAYS = yyy AND ROOM = zzz

Note I've put square brackets around some of the the field names. A space is generally seen as a delimiter between different partsof the SQL statement, so can mess things up if it's in the middle of a field name. The brackets prevent this.

The www, xxx, yyy & zzz, of course, represent the values that you want to check.

If you have Microsoft Access, usually the simplest way to build queries is to let Access do it, then copy them. That is, you use the nice graphical interface to pull in the fields you want, plus in your criteria and so on. Even run the query to check that it does what you want. Then switch to the SQL view, and copy what it built for you.

If you need to know more about SQL syntax, we can probably help, and you can get much more help in the Access forum.
May 23 '07 #2
darrel
72
Thank you fo that idea Mr.Killer now i'am having ideas on how to do it, and sorry for the wrong figure...

Mr.Killer, now what i wanted to do is like this... for example my RECORDS table has have a few records in my field which is TIME START, TIME END, ROOM and DAYS, now for example am going to save another record on it but i have to test first if the details am going to save on my table RECORDS does exist on my FIELDS... because if does exists am going to prompt the user that the data being place in my form is not valid because the details that will be save is already taken.

for example in my RECORD table, it has a TIME START which 5:00pm, TIME END 6:00pm, ROOM, 102 & DAYS, Saturday...

now the user will be saving exactly the same details in my RECORD table. That will an error because it will be the same, it will be a conflict on the schedule. i hope am getting my self clear... Sorry if i cant explain in exact details am having a hard time explaining in English language... hope you can help me with this. thank you...
May 24 '07 #3

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

Similar topics

5
by: Curtis Gilchrist | last post by:
I am required to read in records from a file and store them in descending order by an customer number, which is a c-style string of length 5. I am storing these records in a linked list. My...
2
by: Jason | last post by:
I have a table of 650,000 records associated to contracts. Some of the contracts have multiple records but each contract only has one Active Record (there might be several inactive records). ...
0
by: Jeff Marcum | last post by:
I have two tables that I want to compare and show me the unmatched records. I want to use all fields on both table in the comparison. Here is an example of the fields that are on both tables. ...
4
by: osmethod | last post by:
Hello, I have read many articles about comparing tables, like - loops, delete queries, appending to temp table with index etc Problem: 2 tables T1 & T2. Data is suppposed to be the same in...
4
by: charliej2001 | last post by:
This is my first post on groups and id like to say that already its helped me out loads, but can't quite find what im looking for now I have 3 tables storing information about people; Main, Temp...
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...
0
by: NasirMunir | last post by:
I am trying to compare records from oracle table with a table in access. With oraDynaset, I have the option of .findNext function. I can use that to look for matching records from access to oracle....
11
by: jennifersalcido | last post by:
Hello All, I am working with two tables that contain inventory data: 1) INVENTORY contains item_number, description, etc. This data is relatively straight-forward, one record per item_number....
9
by: warrior2009 | last post by:
I have 2 lists (unlinked and unrelated), where one can be called the parent and the other the child with one to many relationship between parent-child. The child table is really big, over a million...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.