473,503 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the best way to keep a user on a control...

24 New Member
I want to add some data validation to a control, and keep the user there until the data is entered correctly. What I am trying to do is force a user to enter a correct date, based on another date field.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Training_End_AfterUpdate()
  2.  
  3. If [Training_End] > DateAdd("d", 1092, [Training_Start]) Then
  4.  MsgBox "The Training End Date is greater than 156 weeks from the Training Start Date.", vbExclamation + vbOKOnly, "Error 101"
  5. End If
  6. End Sub
What's the best way to do this?

Thanks!
Dave
Dec 1 '10 #1
1 1016
slenish
283 Contributor
The best way I can think of is to keep what you have and just add in..

Cancel = True

right after your MsgBox before your End If so if they put in the wrond date it will keep the focus on the box till they put in the right date.
Dec 2 '10 #2

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

Similar topics

4
2662
by: BBFrost | last post by:
We have a data entry application written within Framework 1.0 that contains 20+ custom user controls. The controls overlay each other so that only one custom control is visible at a time. What...
4
1349
by: Andrea Williams | last post by:
I'm trying to set up a user control and change some values from the aspx page, but I keep running into trouble. What I really would like to do is be able to set a Label.Text in the user control...
4
2431
by: Josh Harris | last post by:
Here is my question: It is common to have many pieces of business logic encapsulated within asp.net user controls. This can be found in high visibility projects such as the iBuySpy portal from...
6
1451
by: Andrea Williams | last post by:
When I step through my code, the ASPX Page_Load happens before the Page_Load in the User Control. This means that the property values are not set to their defaults yet in the User Control and all...
10
1784
by: Mike Street | last post by:
I'm looking for the best way to make se of the function is a dll user control in an ASP.NET page. I've been unable to find anything specific to demonstrate how this can be achieved. Mike
1
1901
by: Neil | last post by:
Hi, I have an aspx page page with some existing controls code etc. This page has an update button which updates a SQL Db based on any user changes. I need to add a new section to this page and a...
9
5291
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
4
1196
by: David Hearn | last post by:
I need to pass some variables to a user control so that some functions that are in it can use them. I am trying to set a public property that I have in it but it isn't working for some reason and I...
9
3164
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
0
1157
by: Sin Jeong-hun | last post by:
http://misako.co.kr/externaldata/Test.aspx I've created a very simple user control which just has a label on it. I followed the instruction but it doesn't show up. I don't know what's wrong...
0
7203
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
7281
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,...
1
5014
isladogs
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...
0
4675
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
3168
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
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
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 ...
1
737
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
383
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.