Datasheet column formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how to set the format via VBA on a field (column) in a
datasheet? The data for the datasheet is set programmatically and depending
on user selection, the field may need to formatted as a percentage or as
currency

Thought I might be able to use conditional formatting but this does not seem
to let one change this type of formatting
Thanks in advance
James
 
J Welsby said:
Does anyone know how to set the format via VBA on a field (column) in
a datasheet? The data for the datasheet is set programmatically and
depending on user selection, the field may need to formatted as a
percentage or as currency

Thought I might be able to use conditional formatting but this does
not seem to let one change this type of formatting
Thanks in advance
James

Assuming you mean a datasheet form, have you tried

if <your condition> then
me!txtNameOfControl.Format = "Percent"
else
me!txtNameOfControl.Format = "Currency"
end if

If it works, it'll format the entire column, which is how datasheets
(and continuous forms) work, as I understand. If formatting individual
row values is the issue, I don't think you can do that with a
datasheet, but perhaps as suggested by Alex Dybenko, use the format
function in the underlying query.
query.
 
Back
Top