change field format of a query on a form with vba

  • Thread starter Thread starter ryan.fitzpatrick3
  • Start date Start date
R

ryan.fitzpatrick3

I have a form that runs a query, how do you change the format of the
fields below? for example I have a button that changes the
recordsource of the form. one of the fields is a short date and when I
click the run button and when it changes to the other recordsource, I
need that one field to be a general number. is this possible? thank
you.

Ryan
 
I have a form that runs a query, how do you change the format of the
fields below? for example I have a button that changes the
recordsource of the form. one of the fields is a short date and when I
click the run button and when it changes to the other recordsource, I
need that one field to be a general number.


In the same block of code that changes the record source to
the general number field query:

Me.thetextbox.Format = "General Number"

And when you change it to the short date query:

Me.thetextbox.Format = "Short Date"

Personally, I prefer to specify the exact format instead of
using the ones that involve the Windows settings (like those
you are using). If your numbers are type floating point, a
format could be: 0.#;-0.#;0.
a date format of: m/d/yy
 
Back
Top