473,513 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calendar

77 New Member
i have three fields where a date needs to be entered..

i have a calendar so when user clicks the field then the user can choose date from calendar and that will be enetered..

what i need is when the user enters date in field 1 then when he chooses date for field 2 the date will have to be after the date in field 1 and msg showing "please choose date after (what ever date is in field 1)"

can anyone help
Mar 19 '07 #1
7 1129
missinglinq
3,532 Recognized Expert Specialist
Where Date1 textbox holds first date and Date2 textbox holds the second date:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Date2_BeforeUpdate(Cancel As Integer)
  2.   If Me.Date1 >= Me.Date2 Then
  3.     Message = "Please Choose Date After " & Me.Date1 & "!"
  4.     MsgBox (Message)
  5.   End If
  6. End Sub
Mar 19 '07 #2
Mubs
77 New Member
i already have the following code for the calendar...

Private Sub Calendar5_Click()
Rental_Out.Value = Calendar5.Value
Rental_Out.SetFocus
Calendar5.Visible = False

End Sub


Private Sub Calendar6_Click()
Rental_Due.Value = Calendar6.Value
Rental_Due.SetFocus
Calendar6.Visible = False

End Sub


Private Sub Calendar7_Click()
Rental_Returned.Value = Calendar7.Value
Rental_Returned.SetFocus
Calendar7.Visible = False

End Sub


Private Sub Rental_Due_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Calendar6.Visible = True
Calendar6.SetFocus
If Not IsNull(Rental_Due) Then
Calendar6.Value = Rental_Due.Value
Else
Calendar6.Value = Date
End If

End Sub


Private Sub Rental_Out_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Calendar5.Visible = True
Calendar5.SetFocus
If Not IsNull(Rental_Out) Then
Calendar5.Value = Rental_Out.Value
Else
Calendar5.Value = Date
End If

End Sub

Private Sub Rental_Returned_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Calendar7.Visible = True
Calendar7.SetFocus
If Not IsNull(Rental_Returned) Then
Calendar7.Value = Rental_Returned.Value
Else
Calendar7.Value = Date
End If

End Sub


this code allows to enter in 3 dates in 3 fields...where do i implement the msg code...??
Mar 19 '07 #3
missinglinq
3,532 Recognized Expert Specialist
what i need is when the user enters date in field 1 then when he chooses date for field 2 the date will have to be after the date in field 1 and msg showing "please choose date after (what ever date is in field 1)"
The code goes in the BeforeUpdate event of the textbox that holds field 2, whatever that "field" is named.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Date2_BeforeUpdate(Cancel As Integer)
  2.   If Me.Date1 >= Me.Date2 Then
  3.     Message = "Please Choose Date After " & Me.Date1 & "!"
  4.     MsgBox (Message)
  5.   End If
  6. End Sub
Replace Date2 in the code with the actual name of your "field 2."
Mar 19 '07 #4
Mubs
77 New Member
The code goes in the BeforeUpdate event of the textbox that holds field 2, whatever that "field" is named.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Date2_BeforeUpdate(Cancel As Integer)
  2.   If Me.Date1 >= Me.Date2 Then
  3.     Message = "Please Choose Date After " & Me.Date1 & "!"
  4.     MsgBox (Message)
  5.   End If
  6. End Sub
Replace Date2 in the code with the actual name of your "field 2."

thanx i got it working
Mar 21 '07 #5
Mubs
77 New Member
thanx i got it working

when i click on the date 2 i get the msg but the calendar still allows me to enter a date before the date 1.. how do i restrict that and only allow dates after date 1??
Mar 21 '07 #6
missinglinq
3,532 Recognized Expert Specialist
Try adding Cancel = True
Expand|Select|Wrap|Line Numbers
  1. Private Sub Date2_BeforeUpdate(Cancel As Integer)
  2.   If Me.Date1 >= Me.Date2 Then
  3.     Message = "Please Choose Date After " & Me.Date1 & "!"
  4.     MsgBox (Message)
  5.         Cancel = True  
  6.   End If
  7. End Sub
Mar 21 '07 #7
Mubs
77 New Member
Try adding Cancel = True
Expand|Select|Wrap|Line Numbers
  1. Private Sub Date2_BeforeUpdate(Cancel As Integer)
  2.   If Me.Date1 >= Me.Date2 Then
  3.     Message = "Please Choose Date After " & Me.Date1 & "!"
  4.     MsgBox (Message)
  5.         Cancel = True  
  6.   End If
  7. End Sub

that piece of code still allows the date to be entered
Mar 22 '07 #8

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

Similar topics

1
2081
by: Sugapablo | last post by:
Can someone recommend a very simple script to produce a web calendar? I just want something where I can select a month and year and it produces a very basic HTML table, 7 columns across, one...
2
14860
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
2
3401
by: Caesar Augustus | last post by:
First, let me start by saying my asp.net experience is still in it's infancy so please bare with me as I try to explain my situation. I have created a single page that with the use of many...
0
1687
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
1
2724
by: R.A.M. | last post by:
Hello, I need to implement popup calendar in ASP.NET application. I created a button opening popup calendar on 'master' page: <asp:Button ID="Calendar" runat="server" Text=Calendar"...
0
1991
by: GV | last post by:
Hi all, New to developing in VS 2005 ASP 2.0 Trying to have a easy pop calender for a button on a web page. I keep getting a error message in IE6 that says: Line 69 Char 3 Error:...
3
2706
by: thorpk | last post by:
I posted this problem earlier in the month and some one decided it was better to change the subject and ask a completely different question. I am therefore reposting. I am hoping some one can...
0
3313
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
4
3295
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
1
3692
by: abhishekbrave | last post by:
The code below is opening a calendar on mouse over in the same window. I need the calendar to be opened in new window. Have to fulfill this requirement urgentely so posting the whole code here. I...
0
7269
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
7177
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
7559
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
7542
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
4756
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...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
470
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...

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.