Solved

Access 2007 Make Table query number format

Posted on 2011-03-09
8
801 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
8 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 500 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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: 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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …

861 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