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

Please reply anyone

hi everybody, Now im doing one project.In that I have to insert the Date Of Birth field into the db table.For that, if anybody enter the DOB field,I have to check whether it is in the format of "MM/DD/YYYY" or not.I have written the code for that is
Expand|Select|Wrap|Line Numbers
  1. If text1.text<>Format$(MM/DD/YYYY) Then
  2. Msgbox"DOB Should Be The Format Of MM/DD/YYYY"
But it hasn't succeeded. So kindly reply me anyone quickly.
Feb 14 '07 #1
3 932
Killer42
8,435 Expert 8TB
hi everybody, Now im doing one project.In that I have to insert the Date Of Birth field into the db table.For that, if anybody enter the DOB field,I have to check whether it is in the format of "MM/DD/YYYY" or not.I have written the code for that is
Expand|Select|Wrap|Line Numbers
  1. If text1.text<>Format$(MM/DD/YYYY) Then
  2. Msgbox"DOB Should Be The Format Of MM/DD/YYYY"
But it hasn't succeeded. So kindly reply me anyone quickly.
The Format() function is used to take a value (number, date, etc) and convert it to a specific format. So for example, you could take a date and use Format() to display it as MM/DD/YYYY. You can't compare it in this way.

There are numerous ways you can enforce the correct input (for example using a masked edit control, or separate DD, MM and YYYY textboxes, or dropdown lists). Once you have the input, you might need to split the text on the slashes and check the three parts. Or, here's a sample of a very quick and rough date-check routine which might be some help...
Expand|Select|Wrap|Line Numbers
  1. Dim S As String, D As Date, Ok As Boolean
  2. S = InputBox("Well?")
  3. If IsDate(S) Then
  4.   D = DateValue(S)
  5.   If S = Format(D, "MM/DD/YYYY") Then
  6.     Ok = True
  7.   End If
  8. End If
  9. If Not Ok Then
  10.   MsgBox "That's not MM/DD/YYYY format"
  11. End If
Feb 14 '07 #2
samycbe
83
Why cant u try a datepicker control ya? Its easy for the user also to select the date.
Feb 15 '07 #3
Killer42
8,435 Expert 8TB
Why cant u try a datepicker control ya? Its easy for the user also to select the date.
Yes, sorry, I forgot to mention that one. And it's probably the preferred option in most cases.
Feb 15 '07 #4

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

Similar topics

16
by: Thomas G. Marshall | last post by:
This message is sent to these newsgroups because they are no longer valid: comp.lang.java comp.lang.java.api comp.lang.java.bugs comp.lang.java.misc comp.lang.java.setup comp.lang.java.tech
4
by: Throw | last post by:
G'day everyone! I would like to design typing tutor exercises for Afrikaans (and other languages possibly). This is for a GPL project. For this, I need a script that can extract words from a...
59
by: Alan Silver | last post by:
Hello, This is NOT a troll, it's a genuine question. Please read right through to see why. I have been using Vusual Basic and Classic ASP for some years, and have now started looking at...
19
by: sasan3 | last post by:
Every thread I start goes out on a tangent simply because some of you people are not reading my posts carefully: Here is the phrase I am proposing for inclusion in the FAQ: "to existing...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
62
by: vubaboota | last post by:
I HAVE SOME SERIOUS PROBLEM , HOW TO MAKE A PROGRAM IN C Q1: Write a program using malloc function. In which you take input from user and allocate memory equal to square of this number. Which...
9
by: Debbie | last post by:
I wonder if anyone can help me out, or point me in the right direction, in solving my current problem: I have started seeing an error on one of my ASP pages. Id displays totally blank except...
12
by: DMcN | last post by:
Firstly this is my first post so thanks in advance for any help. I have created a form in my web page using Flash and all the variables seem OK. So now I have set up the CGI form on my web server...
8
by: rocketboy2000 | last post by:
could anyone provide me with some simple example code of asp classic calling adodb? specifically, i'd like the code to: - call a couple of stored procedures that have optional parameters - share a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.