Solved

Format function in Microsoft Access

Posted on 2014-02-05
10
624 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access / SQL Server - ODBC Problems 16 51
Access Runtime Error '3070' 5 45
access vba 5 52
Access Query function 4 46
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

738 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