Date Validation

  • Thread starter Thread starter Nigel
  • Start date Start date
N

Nigel

1. I have a number of userform textbox controls that are designated as dates
(European Format dd/mm/yy). What is the best method of validating date
entry?

2. Related to 1 above, are there any active-x controls that I can use to
display a calendar that pops up when the user enters the textbox that
requires a date to be entered?

TIA

Nigel
 
IsDate(Textbox1.Text)

or:

Private Sub CommandButton1_Click()
Dim DtVal As Date
DtVal = 0
On Error Resume Next
DtVal = CDate(TextBox1.Text)
On Error GoTo 0
If Not DtVal = 0 Then
Label1.Caption = "Good Date"
Else
Label1.Caption = "Bad DAte"
End If
End Sub

as an example.

Look at the Calendar Control

mscal.ocx I believe. It might be available in the VBE under tools=>
Additional controls (available when you userform has the focus)

--
Regards,
Tom Ogilvy




Nigel said:
1. I have a number of userform textbox controls that are designated as dates
(European Format dd/mm/yy). What is the best method of validating date
entry?

2. Related to 1 above, are there any active-x controls that I can use to
display a calendar that pops up when the user enters the textbox that
requires a date to be entered?

TIA

Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Tom
Thanks for the tips, code works great. Need to investigate how to use the
mscal.ocx control, presumably it has a properties that can be used in VBA
code
Cheers
Nigel
 
Some possible sources of information - may be dated:

http://www.microsoft.com/officedev/index/calendar.htm
Calendar control
[Includes links to 3 articles on the calendar control including
"Using a Calendar Control in Excel"]

http://support.microsoft.com/Support/?kbid=170692
ADT/ODE: Can't Redistribute Calendar Control Without ODE License

http://www.microsoft.com/officedev/tips/regactx.htm
Get the Calendar Control

http://support.microsoft.com/Support/?kbid=165450
XL97: Error Inserting ActiveX Object in a Worksheet



http://support.microsoft.com/Support/?kbid=279098
MOD2000: Cannot Redistribute Calendar Control Without Microsoft Office
Developer License

http://support.microsoft.com/Support/?kbid=236529
MOD2000: Deploying Package with MSCal.ocx Causes Error: "The file
....\$(DllSelfRegisterEx) Could Not Be Registered..."



=====Register the control:
you can register the ocx file yourself.

It should be is MSCAL.OCX in the Windows/sytem directory


Go to Start=>Run from the windows taskbar

type this to register the OCX

regsvr32.exe c:\windows\system\mscal.ocx

to unregister

regsvr32.exe /u c:\windows\system\mscal.ocx

Once you do that, you can create a reference to the control in Excel in the
VBE in Tools=>References

===============<Function to see if Calendar Control is Installed>====

Posted by Jake Marx

p://x46.deja.com/[ST_rn=ps]/getdoc.xp?AN=618556435

From: "Jake Marx" <>
Subject: Re: Dectecting if computer has Excel control
Date: 02 May 2000 00:00:00 GMT
Message-ID: <ecNh2eLt$GA.264@cppssbbsa03>
References: <[email protected]>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-MSMail-Priority: Normal
Newsgroups: microsoft.public.excel.programming

Hi Stefano,

You could try calling this function to see if the Calendar control is
installed on the client machine:

Public Function bCalCtlInstalled() As Boolean
Dim objCal As Object

On Error Resume Next

Set objCal = CreateObject("MSCAL.Calendar")
bCalCtlInstalled = Not objCal Is Nothing
Set objCal = Nothing
End Function


Regards,
Jake Marx

-------------

--
Regards,
Tom Ogilvy

Nigel said:
Tom
Thanks for the tips, code works great. Need to investigate how to use the
mscal.ocx control, presumably it has a properties that can be used in VBA
code
Cheers
Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Hi Nigel

The download link of the control is not working in Tom's link
A lot of the Excel 97 links don't work anymore om the MS site

I can send you a copy if you don't have it
I have also some info on my site
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




Tom Ogilvy said:
Some possible sources of information - may be dated:

http://www.microsoft.com/officedev/index/calendar.htm
Calendar control
[Includes links to 3 articles on the calendar control including
"Using a Calendar Control in Excel"]

http://support.microsoft.com/Support/?kbid=170692
ADT/ODE: Can't Redistribute Calendar Control Without ODE License

http://www.microsoft.com/officedev/tips/regactx.htm
Get the Calendar Control

http://support.microsoft.com/Support/?kbid=165450
XL97: Error Inserting ActiveX Object in a Worksheet



http://support.microsoft.com/Support/?kbid=279098
MOD2000: Cannot Redistribute Calendar Control Without Microsoft Office
Developer License

http://support.microsoft.com/Support/?kbid=236529
MOD2000: Deploying Package with MSCal.ocx Causes Error: "The file
...\$(DllSelfRegisterEx) Could Not Be Registered..."



=====Register the control:
you can register the ocx file yourself.

It should be is MSCAL.OCX in the Windows/sytem directory


Go to Start=>Run from the windows taskbar

type this to register the OCX

regsvr32.exe c:\windows\system\mscal.ocx

to unregister

regsvr32.exe /u c:\windows\system\mscal.ocx

Once you do that, you can create a reference to the control in Excel in the
VBE in Tools=>References

===============<Function to see if Calendar Control is Installed>====

Posted by Jake Marx

p://x46.deja.com/[ST_rn=ps]/getdoc.xp?AN=618556435

From: "Jake Marx" <>
Subject: Re: Dectecting if computer has Excel control
Date: 02 May 2000 00:00:00 GMT
Message-ID: <ecNh2eLt$GA.264@cppssbbsa03>
References: <[email protected]>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-MSMail-Priority: Normal
Newsgroups: microsoft.public.excel.programming

Hi Stefano,

You could try calling this function to see if the Calendar control is
installed on the client machine:

Public Function bCalCtlInstalled() As Boolean
Dim objCal As Object

On Error Resume Next

Set objCal = CreateObject("MSCAL.Calendar")
bCalCtlInstalled = Not objCal Is Nothing
Set objCal = Nothing
End Function


Regards,
Jake Marx

-------------

--
Regards,
Tom Ogilvy

Nigel said:
Tom
Thanks for the tips, code works great. Need to investigate how to use the
mscal.ocx control, presumably it has a properties that can be used in VBA
code
Cheers
Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
See the link on the bottem of my page
http://www.fontstuff.com/vba/vbatut07.htm

You can download the control on this webpage


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




Ron de Bruin said:
Hi Nigel

The download link of the control is not working in Tom's link
A lot of the Excel 97 links don't work anymore om the MS site

I can send you a copy if you don't have it
I have also some info on my site
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




Tom Ogilvy said:
Some possible sources of information - may be dated:

http://www.microsoft.com/officedev/index/calendar.htm
Calendar control
[Includes links to 3 articles on the calendar control including
"Using a Calendar Control in Excel"]

http://support.microsoft.com/Support/?kbid=170692
ADT/ODE: Can't Redistribute Calendar Control Without ODE License

http://www.microsoft.com/officedev/tips/regactx.htm
Get the Calendar Control

http://support.microsoft.com/Support/?kbid=165450
XL97: Error Inserting ActiveX Object in a Worksheet



http://support.microsoft.com/Support/?kbid=279098
MOD2000: Cannot Redistribute Calendar Control Without Microsoft Office
Developer License

http://support.microsoft.com/Support/?kbid=236529
MOD2000: Deploying Package with MSCal.ocx Causes Error: "The file
...\$(DllSelfRegisterEx) Could Not Be Registered..."



=====Register the control:
you can register the ocx file yourself.

It should be is MSCAL.OCX in the Windows/sytem directory


Go to Start=>Run from the windows taskbar

type this to register the OCX

regsvr32.exe c:\windows\system\mscal.ocx

to unregister

regsvr32.exe /u c:\windows\system\mscal.ocx

Once you do that, you can create a reference to the control in Excel in the
VBE in Tools=>References

===============<Function to see if Calendar Control is Installed>====

Posted by Jake Marx

p://x46.deja.com/[ST_rn=ps]/getdoc.xp?AN=618556435

From: "Jake Marx" <>
Subject: Re: Dectecting if computer has Excel control
Date: 02 May 2000 00:00:00 GMT
Message-ID: <ecNh2eLt$GA.264@cppssbbsa03>
References: <[email protected]>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-MSMail-Priority: Normal
Newsgroups: microsoft.public.excel.programming

Hi Stefano,

You could try calling this function to see if the Calendar control is
installed on the client machine:

Public Function bCalCtlInstalled() As Boolean
Dim objCal As Object

On Error Resume Next

Set objCal = CreateObject("MSCAL.Calendar")
bCalCtlInstalled = Not objCal Is Nothing
Set objCal = Nothing
End Function


Regards,
Jake Marx

-------------

--
Regards,
Tom Ogilvy

Nigel said:
Tom
Thanks for the tips, code works great. Need to investigate how to use the
mscal.ocx control, presumably it has a properties that can be used in VBA
code
Cheers
Nigel

IsDate(Textbox1.Text)

or:

Private Sub CommandButton1_Click()
Dim DtVal As Date
DtVal = 0
On Error Resume Next
DtVal = CDate(TextBox1.Text)
On Error GoTo 0
If Not DtVal = 0 Then
Label1.Caption = "Good Date"
Else
Label1.Caption = "Bad DAte"
End If
End Sub

as an example.

Look at the Calendar Control

mscal.ocx I believe. It might be available in the VBE under tools=>
Additional controls (available when you userform has the focus)

--
Regards,
Tom Ogilvy




1. I have a number of userform textbox controls that are designated as
dates
(European Format dd/mm/yy). What is the best method of validating date
entry?

2. Related to 1 above, are there any active-x controls that I can use to
display a calendar that pops up when the user enters the textbox that
requires a date to be entered?

TIA

Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World!
100,000
Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via
Encryption
=---






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Tom / Ron

Thanks for the further info. I have now succesfully incorporated the control
into my form and it work great. Since the form is general purpose it
displays current entries and allows for new entries. The VBA code
dynamically sets the default date in the calendar control to either that
already stored or the today date. Changes are written back to the database.

Thanks again for your support
Cheers
Nigel

Ron de Bruin said:
See the link on the bottem of my page
http://www.fontstuff.com/vba/vbatut07.htm

You can download the control on this webpage


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




Hi Nigel

The download link of the control is not working in Tom's link
A lot of the Excel 97 links don't work anymore om the MS site

I can send you a copy if you don't have it
I have also some info on my site
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)




Some possible sources of information - may be dated:

http://www.microsoft.com/officedev/index/calendar.htm
Calendar control
[Includes links to 3 articles on the calendar control including
"Using a Calendar Control in Excel"]

http://support.microsoft.com/Support/?kbid=170692
ADT/ODE: Can't Redistribute Calendar Control Without ODE License

http://www.microsoft.com/officedev/tips/regactx.htm
Get the Calendar Control

http://support.microsoft.com/Support/?kbid=165450
XL97: Error Inserting ActiveX Object in a Worksheet



http://support.microsoft.com/Support/?kbid=279098
MOD2000: Cannot Redistribute Calendar Control Without Microsoft Office
Developer License

http://support.microsoft.com/Support/?kbid=236529
MOD2000: Deploying Package with MSCal.ocx Causes Error: "The file
...\$(DllSelfRegisterEx) Could Not Be Registered..."



=====Register the control:
you can register the ocx file yourself.

It should be is MSCAL.OCX in the Windows/sytem directory


Go to Start=>Run from the windows taskbar

type this to register the OCX

regsvr32.exe c:\windows\system\mscal.ocx

to unregister

regsvr32.exe /u c:\windows\system\mscal.ocx

Once you do that, you can create a reference to the control in Excel in the
VBE in Tools=>References

===============<Function to see if Calendar Control is Installed>====

Posted by Jake Marx

p://x46.deja.com/[ST_rn=ps]/getdoc.xp?AN=618556435

From: "Jake Marx" <>
Subject: Re: Dectecting if computer has Excel control
Date: 02 May 2000 00:00:00 GMT
Message-ID: <ecNh2eLt$GA.264@cppssbbsa03>
References: <[email protected]>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-MSMail-Priority: Normal
Newsgroups: microsoft.public.excel.programming

Hi Stefano,

You could try calling this function to see if the Calendar control is
installed on the client machine:

Public Function bCalCtlInstalled() As Boolean
Dim objCal As Object

On Error Resume Next

Set objCal = CreateObject("MSCAL.Calendar")
bCalCtlInstalled = Not objCal Is Nothing
Set objCal = Nothing
End Function


Regards,
Jake Marx

-------------

--
Regards,
Tom Ogilvy

Tom
Thanks for the tips, code works great. Need to investigate how to use the
mscal.ocx control, presumably it has a properties that can be used in VBA
code
Cheers
Nigel

IsDate(Textbox1.Text)

or:

Private Sub CommandButton1_Click()
Dim DtVal As Date
DtVal = 0
On Error Resume Next
DtVal = CDate(TextBox1.Text)
On Error GoTo 0
If Not DtVal = 0 Then
Label1.Caption = "Good Date"
Else
Label1.Caption = "Bad DAte"
End If
End Sub

as an example.

Look at the Calendar Control

mscal.ocx I believe. It might be available in the VBE under tools=>
Additional controls (available when you userform has the focus)

--
Regards,
Tom Ogilvy




1. I have a number of userform textbox controls that are designated as
dates
(European Format dd/mm/yy). What is the best method of validating
date
entry?

2. Related to 1 above, are there any active-x controls that I can use
to
display a calendar that pops up when the user enters the textbox that
requires a date to be entered?

TIA

Nigel






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World!
100,000
Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via
Encryption
=---






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000
Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
Back
Top