I swear this worked when I tried it a couple of days ago... now suddenly it doesn't![]()
It's not doing the bit in bold, checking the date entered is greater than the date in txtDateReg.
![]()
Please Login or Register to view this content.
I swear this worked when I tried it a couple of days ago... now suddenly it doesn't![]()
It's not doing the bit in bold, checking the date entered is greater than the date in txtDateReg.
![]()
Please Login or Register to view this content.
An InputBox returns a string, so the comparisons are evaluating things alphabeticaly rather than numericaly. This routine uses CDate to convert those strings to dates. It also uses a more compact structure.
![]()
Please Login or Register to view this content.
Thanks that worked![]()
Could you explain this line in a little more detail please?
Thanks
![]()
Please Login or Register to view this content.
Running the following code, the user can either press Cancel, press OK before entering a value or enter something. In the first two cases, userInput will equal vbNullString.
To distinguish between those:
StrPtr(userInput) returns the memory location where the value of the variable is stored.
If OK is pressed, the value vbNullString is assigned to the variable userInput, which involves putting that value in a memory location.
If Cancel is pressed, no value is assigned to userInput and its pointer remains 0, i.e."unassigned".
StrPtr(UserInput)=0 will test if the Cancel Button was pressed.
Note also that if "123" is entered, it is read as a string not a number. These are two of the reasons that I prefer to use the![]()
Please Login or Register to view this content.
Application.InputBox method rather than InputBox function used in the posted code.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks