SetTempVar

  • Thread starter Thread starter AccessMan
  • Start date Start date
A

AccessMan

I am using a macro to prompt the user to enter a date and am setting the
entered value to a temporary variable with SetTempVar. There are two
problems.

1 - I see evidence that the temporary variable is representing the entry as
text, and I would like to convert the entered value into a true date.

2 - Since the user may actually enter anything, I'd like know how to detect
if a non-date has been entered and either reprompt for a new entry or stop
the macro altogether. I've seen IsDate used somehow in the Condition column,
but I can't quite remember how.

Solving these would really make my week!
 
I'm trying to do something similar - and have come unstuck ... is there
anyone out there who can help?
 
I have just seen something in another thread that may help, searching on
"convert text to date in Access" .... but haven't tried it yet ....

to convert the text to date

DateSerial(Left(value,4),Mid(value,5,2),Right(value,2))

I think this must assume that the date is in the format YYYYMMDD (but the
thread doesn't say that), .... and I haven't yet worked out how translate
this to my needs (my date is DD/MM/YYYY)- but at least it is a start, and
something to go on?? Let me know if helps.

Good Luck!
 
Amazingly .... i've sorted what I needed .... the reason I had been getting
Name errors on my form ..... was because it is necessary to refer to the Temp
Variables as Access requires it .... there is a gaping hole in the help text
(unless you study the example very carefully!!!

All I did was refer to it as [TempVars]![MyVar] instead of just [MyVar] and
it worked ... even though it appeared to be formatted as text - Access worked
it out - and the comparison works! (DateSerial message was red herring -
sorry!!!)

Wey Hey !!!! On to the next challenge!

Good Luck - AGAIN!!!
 
Back
Top