Solved

Access 2007 Make Table query number format

Posted on 2011-03-09
8
797 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:JCJG
Comment Utility
I am not getting a workable solution
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
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
Comment Utility
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
Comment Utility
Starting auto-close process to implement the recommendations of the participating Expert(s).
 
modus_operandi
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

8 Experts available now in Live!

Get 1:1 Help Now