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
Alex Dybenko - 17 Nov 2006 06:26 GMT
Hi,
you can try to apply formatting in underlying query, just use Format()
function to set appropriate format for each record.

Signature
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
> 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
[quoted text clipped - 7 lines]
> Thanks in advance
> James
RoyVidar - 17 Nov 2006 07:48 GMT
"J Welsby" <JWelsby@discussions.microsoft.com> wrote in message
<F4FBA415-D3DE-4801-B79A-272BA6974489@microsoft.com>:
> 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
[quoted text clipped - 5 lines]
> 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.

Signature
Roy-Vidar