Link to home
Start Free TrialLog in
Avatar of lehi52
lehi52

asked on

Format function in Microsoft Access

I have fields from one table that are merged into another table.  That is then put into an email.  The fields that are merged into the email (like numbers) need to be formatted into their respective formats.  For example, I have a dollar amount field that merges into the email with the number but not the dollar amount format.  I have the phone number that needs to put in the phone format.  How do I do that?  

I attached a sample database to see what it looks like.  It you click the Send email you will see what I am referring to.
1.accdb
Avatar of mbizup
mbizup
Flag of Kazakhstan image

You would use the Format and/or Input Mask properties of the respective textboxes in the reports' designs.

For example, for phone numbers set the Input Mask to "Phone Number"  (selectable by clicking the ... next to Input Mask)


For currency, set the Format property of the textbox to Currency.
i added new function that you should be able to add "Format" in the your table.
Look on sample
{Format([Connam Phone],"(###) ###-####")}
2.accdb
ASKER CERTIFIED SOLUTION
Avatar of Gozreh
Gozreh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lehi52
lehi52

ASKER

What about if I add a field for money like EPLI Down or EPLI TOTal. what is the code format for that.  The only three I can see needing are phone, date, and money (outside of regular text).
All you need to do is add the format property to the textboxes... any currency fields should show Currency in their FOrmat property.
Avatar of lehi52

ASKER

I tried the format property and it did not put the format into the email.
Avatar of lehi52

ASKER

Gorzeh,  the changes you made worked.  Thanks.  You are a lot of help.
Avatar of lehi52

ASKER

This worked great.
If you open the report in print preview first, the textbox input masks and format properties will make it into the email:

   DoCmd.OpenReport "actions and opps", acViewPreview
   DoCmd.SendObject acReport, "actions and opps", "PDFFormat(*.pdf)", Me.[Connam Email], , , "Action and Opportunities", strBody
   Docmd.Close acreport , "actions and opps"

Open in new window

Just looking at some of your recent questions, it looks like you are receiving some top-notch advice from many Experts here, but are favoring neatly packaged, 'fixed' databases when accepting solutions.

I sincerely hope that you are trying to understand the solutions posted and learn independently rather than building a database by passing a sample database from one question to the next for Experts to fix and build.

As rapidly as you are posting new questions with this sample progressing from one question to the next... the problem 'authors' eventually run into with this approach is that they wind up with an unstable database filled with code that they personally do not understand, and issues that are difficult for them to even formulate questions about.

Just a word of caution, and a suggestion to slow down a bit and really read through the comments you are receiving from Scott McDaniel, Jack Leach, Jim Dettman, and others who are trying to help you learn as you go.