?
Solved

Access 2007 Make Table query number format

Posted on 2011-03-09
8
Medium Priority
?
807 Views
Last Modified: 2012-05-11
Hi, I am creating a make-table query with a number field.  I'd like the number field with 4 decimal places in the output table.  How do I do that?  Thanks.
0
Comment
Question by:JCJG
7 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35092494
In design view of a Make Table Query use a Format function of the column you want to format:

E.g. Account1:Format([Account],"0.0000")

Sincerely,
Ed
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35093869
I don't think you can do this within the make-table query.

Mindsuperb's answer will create a text field, not a number field, although the results for the current data will show with 4 dp in that text field.  
0
 
LVL 8

Accepted Solution

by:
Andrew_Webster earned 2000 total points
ID: 35095015
You could use a conversion function in the SQL to make sure that you have a field that is the correct datatype.

SELECT  CCur(MyNumberColumn) INTO MyTable

The problem that you have is one of formatting, and that will have to be set using either DDL to alter the column format (tough-ish in Access), or using ADOX (ok-ish), or by hand.

A solution that is used all the time in the data warehousing world is to use more than one layer of tables.  Use the make table code to pull the data in (or better use a "kill and fill" truncate and load), but then transfer it to a staging table that's in the correct format, validate it, then pull it in to the main database.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JCJG
ID: 35250881
I am not getting a workable solution
0
 
LVL 77

Expert Comment

by:peter57r
ID: 35255748
I  agree that the poster is not getting a workable solution.
That is because, as I said in my response, it can't be done in the way they are asking.
Andrew Weir gave an approach that is can be used to carry out the poster's requirements.

The table must be defined in advance and an append query used, or the table must be  modified  in code to set the number of decimal places.
Another code example.
CurrentDb.TableDefs("<tblname>").Fields("<fldname>").Properties("DecimalPlaces") = 4

0
 
LVL 8

Expert Comment

by:Andrew_Webster
ID: 35260382
Thanks Peter, that's exactly right.  

JCJG, there is no magic way to do this, it's going to take several steps to make sure that it works as you want it to.  I've had to build solutions for problems like this many times, and it's exactly as Peter and I have described.
0
 
LVL 1

Expert Comment

by:modus_operandi
ID: 35312682
Starting auto-close process to implement the recommendations of the participating Expert(s).
 
modus_operandi
EE Admin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Screencast - Getting to Know the Pipeline
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

850 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