format in SQL queries

D

Doo-Dah Man

I have a form that creates a SQL SELECT statement using variables
populated by a couple combo boxes on a form. The query is recreated
using VBA each time the form runs. Is there a way to format the
fields used in the query via SQL? There are some currency values that
I want formatted accordingly. Since the query is deleted and
recreated each time the form runs, I can't set the properties in the
Design view of the query. I was hoping there's a way to do it in VBA
where the SQL gets written.

Thanks for any help!
 
T

TC

If the query is only for viewing (not update), just use the Format()
function to get whatever format you want for each column.

So instead of:
SELECT MyAmt, ...

use:
SELECT Format(MyAmt, "...."), ...

Check out Format in online help.

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top