I have attached an example of a validate routine that I have used to make sure the data entered in a textbox is a valid date and within the acceptable range for the application. This allows the user to enter a date anyway they want as long as it converts to a valid date ("6/14/04" or "06/14/04" or "6/14/2004" etc.) After you have assured that the date is valid, you can use the format function to pass the date in the correct format. ie. Format(CDate(txtDOS.txt),"mm/dd/yy")

Private Sub txtdos_Validate(KeepFocus As Boolean)
If Not IsDate(txtDOS.Text) Then
MsgBox "Invalid Date of Service!", vbOKOnly + vbExclamation, "Eligibility Inquiry"
KeepFocus = True
End If
If CDate(txtDOS.Text) > Now Then
MsgBox "Future Date of Service is not allowed!", vbOKOnly + vbExclamation, "Eligibility Inquiry"
KeepFocus = True
End If
If CDate(txtDOS.Text) < CDate("1/1/2000") Then
MsgBox "Date of Service before 1/1/2000 is not allowed!", vbOKOnly + vbExclamation, "Eligibility Inquiry"
KeepFocus = True
End If
End Sub


Rich McNeil wrote:

Mickey,

I believe the DATAFORMAT property applies to database field formatting and
perhaps not to fixing the format of a standalone textbox.


The UserForm Textbox doesn't have such a property.  There are two approaches
to this.  You could add a control to the form that has this feature.   The
Microsoft Masked Edit Control is one option although while it guarantees a
format (like "##/##/##") it doesn't guarantee that is an actual valid date.

The second option is to check the field for validity upon leaving it (which
fires an Exit event).  In Exit see if you like the data and then pop up a
message and cancel the exit if you don't.  I like this option the best.

Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com


-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mickey Sherbett Sent: Monday, June 14, 2004 8:43 AM To: [EMAIL PROTECTED] Subject: RE: [Talk] log off

Rich,

Using the new 7.0 or this may be the case for 6.5, I have created a User
Form with a text box and I need it to be formatted in a Date Format,
06/14/04. What property do I use? I checked in Visual Basic 6.0 there is a
property DATAFORMAT that lets you do it. I would like to restrict the user
from entering in invalid dates.

Thanks,

Mickey Sherbett, Senior Analyst
DCH Regional Medical Center 809 University Blvd. E.
Tuscaloosa Al. 35401

205-759-7167
[EMAIL PROTECTED]



The information contained in this email message is confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient or the employee or agent responsible to deliver it to the intended recipient, the reader is hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rich McNeil
Sent: Wednesday, June 02, 2004 7:20 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] log off

I know it's a pain in the neck but "shooting blind" hardly ever works
(although it's worth a try). In the scripts we write we usually have a
"Reset" subroutine that moves to an anchor screen (connecting and logging on
if necessary) no matter where in the script we call it. It's usually a big
loop of PauseLoop commands that list every screen and the key that gets to
the anchor.


For this situation, the most reliable technique would be to call such a
Reset subroutine and then call a explicit sequence of Pause's and Key's to
log you off from the anchor screen.

Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com


-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of MORRILL,DENISE Sent: Wednesday, June 02, 2004 12:08 PM To: [EMAIL PROTECTED] Subject: RE: [Talk] log off

I tried the Key {"ESC"} multiple times, and although it logged off the
system, the script  still considered itself running.  When I removed the
excess {ESC} keys, to give it only exactly the number it needed, the script
completed correctly.

Denise Morrill
Spring Harbor Hospital

-----Original Message-----
From: Rich McNeil [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 02, 2004 12:03 PM
To: [EMAIL PROTECTED]
Subject: RE: [Talk] log off


Joe,


The Active might take more than a few seconds to become accurate after
shutdown.  As an alternative, how about:

WS.Key "{Esc}{Esc}{Esc}{Esc}{Esc}{Esc}"

I'd be interested to see whether this works.  Would you let us know?

Rich McNeil
Boston Software Systems
866 653 5105
www.bostonworkstation.com


-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Strauss Sent: Wednesday, June 02, 2004 10:45 AM To: [EMAIL PROTECTED] Subject: [Talk] log off


My script to log out of a Client/Server session is sometimes having problems. It looks something like this (using VB6):

Do
 WS.Key "{ESC}"
 WS.Wait 2
Loop Until Not (WS.Active)

I have a suspicion that the 'Active' is not always correct. Is there
another way to check if the session is still active or maybe a better way to
log out and close out the session?

Thanks.

Joe Strauss
Senior Programmer/Analyst
Specialty Laboratories @ <www.specialtylabs.com>
(310) 828-6543 ext. 1240
CONFIDENTIAL NOTICE: This email message, including any attachments, is
intended only for the use of the intended recipient(s) and may contain
information that is privileged, confidential and prohibited from
unauthorized disclosure under applicable law. If you are not the intended
recipient of this message, any dissemination, distribution or copying of
this message is strictly prohibited. If you received this message in error,
please notify the sender by reply email and destroy all copies of the
original message. Spring Harbor Hospital Maine's Mental Health Network










-- Neil Carman Director Technical Development Manigault & Associates LLC

http://www.m-allc.com
Work: (805) 680-5601
Fax:  (714) 968-5632



Reply via email to