|
-
Mar 26th, 2000, 08:00 PM
#1
Hi, My name is Joseph and am a beginner in VB. I have created various forms that have a MaskEdBox with the mask of ##/##/#### to portray the Date. In my Access Database I have the field data type defined as Date (ShortDate). When I update a new record in VB6 I receive the Error Occurred message. When I go to the Access db and chage the data type of the date field to text and update a new record in VB6 no errors occur. When I create reports in Access (data Type = text) and use criteria in the date field, for example Between "01/01/1999" And "12/31/1999" or "01011999" And "01311999" the report shows other dates that are not in the range selected. However if I change the field data type to Date and replace the quotes " for # the report gives me valid data. I would like to know how I can use the mask in vb6, maintain the field as a date field rather than a text so that my reports produce valid data.
Thanks Joe
-
Mar 30th, 2000, 07:41 PM
#2
Addicted Member
I suggest not using the MaskEdBox at all. Instead of it, use a regular TextBox control and before updating the record, check if its Text property contains a valid date by using the IsDate function.
Good Luck!!!
-
Apr 1st, 2000, 04:57 AM
#3
I agree with you, however, I like what the maskedbox does for the users, it gives them that Format __/__/____
which I believes assures at least a correct mm/dd/yyyy reply. Is there another way this can be done using the text box ????
-
Apr 10th, 2001, 05:44 PM
#4
Hyperactive Member
does that assure you of a valid date?
for the __/__/____ mask, what if the user types
83/78/2002? you need logic to check if month <=12, day <=31 (how about feb? not 31 days, sometimes 28, sometimes 29).
imho, using IsDate() is the way to go, but this still requires the user to type in the slashes...sob
[vbcode]
'*****************************
MsgBox "MCD :: [email protected]", vbInformation + vbOKOnly, "User"
'*****************************
[/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|