473,388 Members | 1,209 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,388 software developers and data experts.

Display an Alert

Hi All

Our Company is provided courses to employees for one or more days i.e.
there are three field (EmpNo, StartDate and EndDate) of course. I am
trying to display an Alert message when a perticular employee has to
attend a new course If he is busy in the other course between these
two dates.

Thanks in advance

Naushad
Nov 17 '08 #1
1 2244
You have an overlap between event A and event B if:
- A starts before B ends, AND
- B starts before A ends, AND
- it's the same employee, AND
- it's not the same event.

To achieve the 4th part, you will need a primary key in your table.
The example below assumes an AutoNumber primary key named ID.

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strWhere As String
Dim varResult As Variant
Const strcJetDate = "\#mm\/dd\/yyyy\#"

If ((Me.EmpNo = Me.EmpNo.OldValue) AND _
(Me.StartDate = Me.StartDate.OldValue) AND _
(Me.EndDate = Me.EndDate.OldValue)) OR _
IsNull(Me.EmpNo) OR _
IsNull(Me.StartDate) OR _
IsNull(Me.EndDate) Then
'do nothing
Else
strWhere = "(EmpNo = " & Me.EmpNo & ") AND (StartDate <= " & _
Format(Me.EndDate, strcJetDate) & ") AND " & _
Format(Me.StartDate, strcJetDate) & _
" <= EndDate) AND (ID <" & Me.ID & ")"
varResult = DLookup("ID", "Table1", strWhere)
If Not IsNull(varResult) Then
Cancel = True
MsgBox "Clashes with event id " & varResult
End If
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Naushad" <nh*****@kockw.comwrote in message
news:b3**********************************@r36g2000 prf.googlegroups.com...
Hi All

Our Company is provided courses to employees for one or more days i.e.
there are three field (EmpNo, StartDate and EndDate) of course. I am
trying to display an Alert message when a perticular employee has to
attend a new course If he is busy in the other course between these
two dates.

Thanks in advance

Naushad
Nov 17 '08 #2

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

Similar topics

1
by: Alex Li | last post by:
Dear js/xmlhttp experts, I spent hours but could not solve this problem and hope someone could give me a clue: a onclick event will invoke a function to do a few things: 1. make a hidden DIV...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
5
by: PJ6 | last post by:
When I call this function (I verified that I'm actually getting an element with the id), why does IE ignore my attempt to set the display to none? <script> function test(id) { elem =...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
5
by: libsfan01 | last post by:
function switch_display(switchme) { var el = document.getElementById(switchme); el.style.display = (el.style.display == 'none')? '' : 'none'; } im using this function to switch the display on...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
3
by: C.W.Holeman II | last post by:
Using this test: <html> <body> <xyz> <form> <input type="checkbox" onchange="alert(this); alert(this.parentNode.previousSibling);"> </form> </body>
1
by: azgaranoop | last post by:
Hi, i want to display a alert box when a user leave my site.... Means if a user clck on X button i.e on top right corner of the browser or the user click on the address bar and try to change the...
23
by: Marge | last post by:
This may be in the wrong forum, but here goes. How can I display an alert in the users browser window from an asp page. For example, a welcome message. I know I can do this with response.write,...
8
by: chinni1 | last post by:
Hiii. Iam using alert box to display the total payment modes. But in Alert it displaying only 62 out of 110. my Code:: var hidpaym = document.frmrechnung.hidpayt.value; var str =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.