Help with Syntax in Access Control Properties

  • Thread starter Thread starter tsisolutions
  • Start date Start date
T

tsisolutions

Hi all,

I'm having a problem with a certain syntax. I need On Form Load to
check loop through each control and if a control has a date format
apply a certain format to that control.

The reason I'm doing this is because I would like each textbox control
with a date format in it to the following format ex: "11-Nov-2007
5:30PM". However, because my application is distributed in the US and
Canada, I need it to have the date format according to their local
settings (dd-mmm-yyyy or mmm-dd-yyyy) Ideally I'd like it to look
something like this:

ctl.Format = Format(ctl, "Medium Date") & " " & (ctl, "Medium Time")

so that the date format are take from Windows settings.

I just can't seem to find a way to catch the controls whose format is
date and actually modify that form's control on Load to the format I
need.

Any help would be greatly appreciated....

Lawrence
TSI Solutions
 
Why not place a pointer in the date control tags. That way you can check for
the appearance of that pointer in a tag.

So; if you have a date control, place the word "check" in the tag of that
control. Do this for every datecontrol on your form.

Now in the form load event place this code:

Dim ctl as control

for each ctl in me
if ctl.tag="check" then
ctl.Format=Format(ctl, "Medium Date") & " " & (ctl, "Medium Time")
end if
next

hth
 
Why not place a pointer in the date control tags. That way you can check for
the appearance of that pointer in a tag.

So; if you have a date control, place the word "check" in the tag of that
control. Do this for every datecontrol on your form.

Now in the form load event place this code:

Dim ctl as control

for each ctl in me
if ctl.tag="check" then
ctl.Format=Format(ctl, "Medium Date") & " " & (ctl, "Medium Time")
end if
next

hth
--
Maurice Ausum












- Show quoted text -

Hi Maurice,

Thanks for the reply. The idea is great however I already use the
tag for another function (enable/disable field based on access levels)
so it's a little hard to go back and add something to the tag and then
have to parse it in order to get the right data format. I know there's
a way loop through all the properties and get the "Format" property
and then read the value i.e. "General Date" but I tried something like
ctl.Properties("Format") and it gave me an error...
Perhaps I should use the index value for the Format Property but I
can't seem to find it.
 
Thanks for the reply. The idea is great however I already use the
tag for another function (enable/disable field based on access levels)

PMFJI. If you don't make use of field validation then the ValidationText
field is useful as another tag property...
 
Back
Top