Solved

Format function in Microsoft Access

Posted on 2014-02-05
10
618 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 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
 

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now