Hello World
I have a problem in detecting the conflict schedule (Day and Time). Day
1. M
2. T
3. W
4. TH
5. F
6. S
7. M/TH <---My problem :(
8. T/F <---My problem :(
9. W/S <---My problem :(
Where: (M='Monday', [T]='Tuesday', and so on...)
Let's say I have this existing schedule on my database: -
Monday(Day) 7:00 AM(TimeIN) 8:00 AM(TimeOut) AVR(Rooom)
-
Here's my sample code and it is working but if the Day='M/TH' or Day='T/F' or Day='T/F' it can save the record even if it has already a schedule for that (refer to sample above). -
Public Function Conflict(ByRef adConnection As ADODB.Connection, ByRef adRecordset _
-
As ADODB.Recordset, ByRef Day As String, ByRef Room As _
-
String, ByRef Course As String, ByRef TimeStarted As Date, ByRef TimeFinished As _
-
Date) As Boolean 'ByRef Subject As String,
-
Conflict = False 'Default value
-
-
'Opens and checks the connection
-
SetConnection
-
CheckConnection adRecordset
-
-
adRecordset.Open "Select * From LoadSchedules Where " & _
-
"Day='" & Day & "' And Rooms.Title='" & Room & "' And Courses.Title='" & _
-
Course & "' And (TimeStarted Between #" & TimeStarted & "# And #" & _
-
TimeFinished & "# Or TimeFinished Between #" & TimeStarted & "# And #" & _
-
TimeFinished & "#)", dbConnection, 1, 1
-
-
'Checks if there is duplicate title
-
If adRecordset.RecordCount > 0 Then
-
Conflict = True
-
Else
-
Conflict = False
-
End If
-
End Function
-
Any solution will be greatly appreciated : )
Rey Sean
14 3506
hi
replace 'or' in the bold line with 'and'
adRecordset.Open "Select * From LoadSchedules Where " & _
"Day='" & Day & "' And Rooms.Title='" & Room & "' And Courses.Title='" & _
Course & "' And (TimeStarted Between #" & TimeStarted & "# And #" & _ TimeFinished & "# Or TimeFinished Between #" & TimeStarted & "# And #" & _
TimeFinished & "#)", dbConnection, 1, 1
regards
manpreet singh dhillon hoshiarpur
hi
replace 'or' in the bold line with 'and'
adRecordset.Open "Select * From LoadSchedules Where " & _
"Day='" & Day & "' And Rooms.Title='" & Room & "' And Courses.Title='" & _
Course & "' And (TimeStarted Between #" & TimeStarted & "# And #" & _ TimeFinished & "# Or TimeFinished Between #" & TimeStarted & "# And #" & _
TimeFinished & "#)", dbConnection, 1, 1
regards
manpreet singh dhillon hoshiarpur
Hi
This query is working well, if you replace OR with AND it cannot detect conflict. What am I asking is that how can I detect conflict
Note:
'M/TH' means Monday or Thursday... they contain same schedule. It should not add a new schedule for Monday or Thursday.
Like what I said, if there is existing Day='M', then when I add a new schedule
Day='M/TH' it should prompt conflict (Assuming they have both the same room, course, and time)
Rey Sean
Hello
Is there anyone can help me???
Better you post it in Sql Server forum. There you can get it.
Better you post it in Sql Server forum. There you can get it.
Hello
I'm calling all the experts that could help me
Please help :(
Hi Lotus
If I got ur problem.....
Can't u change the database field width? To store 4 characters "M/Th"...
R u storing in the same way already?
Hi Lotus
If I got ur problem.....
Can't u change the database field width? To store 4 characters "M/Th"...
R u storing in the same way already?
Hi Mohan
Thanks for responding. All I thought that no one could help me out right here :(
Here's my database structure: click
I posted it on sql forum but unfortunately no one wants to help me :(
Rey Sean
Hi Mohan
Thanks for responding
:
:
I posted it on sql forum but unfortunately no one wants to help me :(
Rey Sean
Hi Lotus
Here what I mean to say is..... r u storing M in one record and in a conflict record M/Th or otherwise u want to get M schedule from one record and Th schedule from other?
So, as I am in a bit confusion...
Hi Lotus
Here what I mean to say is..... r u storing M in one record and in a conflict record M/Th or otherwise u want to get M schedule from one record and Th schedule from other?
So, as I am in a bit confusion...
Hi Mohan
I have these records on my Day Table - M
- T
- W
- TH
- F
- S
- M/TH
- T/F
- W/S
Let say if I have this existing schedule: - ScheduleID = 10001
- StartTime = 8:30 AM
- EndTime = 1:00 PM
- Day = M
- Room = AVR
- Course = BSN
Then If I add this new entry - ScheduleID = 10002
- StartTime = 9:00 AM
- EndTime = 10:00 AM
- Day = M/TH
- Room = AVR
- Course = BSN
This should prompt a conflict in schedule because there is already a schedule for monday, then the new entry shouldn't be added. : ) Note: M/TH means 'Monday' or 'Thursday', I used this if they have both the same schedule. Because it would become redundant if add a new schedule for monday and add another for thursday with the same day, time, room and course : (
Rey Sean
- M
- T
- W
- TH
- F
- S
- M/TH
- T/F
- W/S
Note: M/TH means 'Monday' or 'Thursday', I used this if they have both the same schedule. Because it would become redundant if add a new schedule for monday and add another for thursday with the same day, time, room and course : (
Rey Sean
Hi Lotus
Can't u put validation when u r entering/adding a new schedule on
- Day and Time
- and, if required, Room and Course
Can't u use InStr( ) for getting the M or Th?
Am I getting ur problem?
Hi Mohan
I'm planning to change the T to TU as Tuesday so that if I used LIKE operator in sql statement it cannot select the records of TH or M/TH. But there's one problem, if I already have a schedule on 'M' and I want to add another same schedule that is 'M/TH'.
try to change it to = instead of LIKE. It is diff. between LIKE and =.
Just try Sql query -
Dim strSql as String
-
for i = 0 to UBound(Split(Day,"/"))
-
<Asigen strDayStringHere by spliting Day by "/"
-
-
strSql = "Select * from tblTableName WHERE Day like %'" strDayStringHere "'% and <other criteria>"
-
...
-
...
-
-
Note: 1. Day maybe a data type so use ShedDay
2. If record count is > 0 then days are repeated.
if I already have a schedule on 'M' and I want to add another same schedule that is 'M/TH'...
plan your procedure first.
M - have some work.
M/TH - Have <another work> or <same work>?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chad |
last post by:
I have COM component embedded on html page. It has version 1.0.0.1 (by default). I have converted it in cab file. Code of html is something like:
<HTML><HEAD></HEAD><BODY><OBJECT...
|
by: VHR |
last post by:
Hi,
I apologize for posting this a second time, but no one replied from
the other group where I posted it.
I have a design master and 4 replicas that I have successfully synced
on about 4-5...
|
by: Vadim Biktashev |
last post by:
Hello all
I would like to give a certain name to a certain global variable. Unfortunately,
this name is already used in math.h for a mathematical function. Worse, I do
need to use maths library...
|
by: Kuriandungu |
last post by:
Hi guys
I've read the posts on Write conflict entered in this forum (along with some from kbAlertz and microsoft) and i have tried all the solutions without success. let me give you some background....
|
by: VK |
last post by:
I wandering about the common proctice of some UA's producers to spoof
the UA string to pretend to be another browser (most often IE).
Shouldn't it be considered as a trademark violation of the...
|
by: lotus18 |
last post by:
Hi
This is a follow-up post from my post (please click here) as CyberSoftHari suggested me to post it here.
These are the tables that I've made:
Schedules
-ScheduleID
-StartTime
|
by: lotus18 |
last post by:
Hello all
I have these records on my Day Table for my complete database table please click here
1. M
2. T
3. W
4. TH
5. F
6. S
|
by: themadjester |
last post by:
This is weird, I know what an IP address conflict is, and how to avoid it, but this problem seems atypical - and apparently client side?
Basically I have a router internet network, it is DHCP and...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |