Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Format function in Microsoft Access

Posted on 2014-02-05
10
Medium Priority
?
630 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 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
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

721 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