Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Format function in Microsoft Access

Posted on 2014-02-05
10
Medium Priority
?
633 Views
Last Modified: 2014-02-19
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
0
Comment
Question by:lehi52
  • 4
  • 4
  • 2
10 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39837522
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.
0
 
LVL 10

Expert Comment

by:Gozreh
ID: 39837529
i added new function that you should be able to add "Format" in the your table.
Look on sample
{Format([Connam Phone],"(###) ###-####")}
2.accdb
0
 
LVL 10

Accepted Solution

by:
Gozreh earned 2000 total points
ID: 39837578
i added now in the table {Format([WCF Prem],"Currency")} to test, so i made some miner changes to the code
3.accdb
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 

Author Comment

by:lehi52
ID: 39837588
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).
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39837592
All you need to do is add the format property to the textboxes... any currency fields should show Currency in their FOrmat property.
0
 

Author Comment

by:lehi52
ID: 39837596
I tried the format property and it did not put the format into the email.
0
 

Author Comment

by:lehi52
ID: 39837606
Gorzeh,  the changes you made worked.  Thanks.  You are a lot of help.
0
 

Author Closing Comment

by:lehi52
ID: 39837608
This worked great.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39837610
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

0
 
LVL 61

Expert Comment

by:mbizup
ID: 39837693
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.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question