Solved User is not able to select any date after today's date (1 Viewer)

goncalo

Member
Local time
Today, 22:14
Joined
May 23, 2023
Messages
51
Hello everyone
I am using the date picker developed by Trevor Eyre and i would like to make it so that the user CANNOT pick any date that is after today's date.
How can i achieve this?
Thank you
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,310
He supplies
Optional MaximumDate As Date = 0, _

Use that?
 

goncalo

Member
Local time
Today, 22:14
Joined
May 23, 2023
Messages
51
yeah it was kinda like that, 2 minutes after i posted here i managed to make it work:ROFLMAO:
this was the code i used if anyone else is in need of the same thing

Dim data As Date
data = CalendarForm.GetDate(MaximumDate:=Date, FirstDayOfWeek:=Monday)


thank you for answering tho Gasman !
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,310
I never bother with keywords, as I cannot remember them, plus more to type.
I use intellisense for the correct position.

Always amazes me why others get the positions wrong.
There was a thread with just that error the other day. :)
 

GPGeorge

Grover Park George
Local time
Today, 14:14
Joined
Nov 25, 2004
Messages
1,873
Intellisense offers the keywords, not just the positions. ;)
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,310
George,
How does one use those keywords then, when presented with the pic below. Not that I want to use them, but still curious. :)

1686318715910.png
 

GPGeorge

Grover Park George
Local time
Today, 14:14
Joined
Nov 25, 2004
Messages
1,873
The keyword in bold is the next up in sequence that you need to insert: SelectedDate.

It's identified for you as a Date, i.e., not a number or string, and you get a sample valid value. Once you enter it, the next term will appear in bold, offering you the next keyword, with its datatype and a sample valid value. And on you go, one keyword at time. If you look at the keyword, and decide not to use it, entering a comma moves to the next one.

In fact, I would go so far as to suggest that you actually have shown condensed documentation for Calendarform.GetDate and that is useful information in itself. On the other hand, the line above it, with three placeholder commas, tells you nothing about what would go in those places.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,310
No, I mean how would you get the keywords in, instead of positional parameters?
What you have just stated is how I use intellisense to get the parameters in the correct location.
 

cheekybuddha

AWF VIP
Local time
Today, 22:14
Joined
Jul 21, 2014
Messages
2,280
Parameters shown in square brackets are optional. If you only wanted to pass the TodayFontColor parameter then you might wish to type its name and not have to bother with all those commas. Certainly makes readability easier when you revisit the code!
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:14
Joined
Feb 28, 2001
Messages
27,188
No, I mean how would you get the keywords in, instead of positional parameters?
What you have just stated is how I use intellisense to get the parameters in the correct location.
You use the original name of the formal argument as it was defined.

If I have defined a sub like this:
Code:
    Private Sub MyFunkySub( FullName As String, Gender As String, Age As Integer, ...)

Then you could call it like this:
Code:
    MyFunkySub FullName:="Smith", Age :=25, ....

This next one is an actual example from something I do in my genealogy DB when I'm building a family tree diagram, where I have to sort a spreadsheet on 3 columns in ascending order with no header row...

Code:
    xgWkSh.Columns("A:C").Sort key1:=xgWkSh.Columns("A"), order1:=xlAscending, Header:=xlNo
 

cheekybuddha

AWF VIP
Local time
Today, 22:14
Joined
Jul 21, 2014
Messages
2,280
I guess that Gasman is more wondering how can you automatically insert the parameter name without having to memorise it from the Intellisense and type it out correctly.

I wouldn't be surprised to find that there is some little known key-combo that will do this for you, but no-one ever uses! :oops:
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:14
Joined
Sep 21, 2011
Messages
14,310
Yes, exactly, that was my query.
However your suggestion for the just the last parameter was a good reason to use them. :)

Mind you, that function had the most parameters I have ever seen in a function, all needed of course, but still....:)
 

Users who are viewing this thread

Top Bottom