Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to add a column to a exist table with a query in access 2013

Posted on 2013-05-26
5
Medium Priority
?
866 Views
Last Modified: 2013-05-26
hi

i want to add a coulumn to table that the values are format like percents something like this

ALTER TABLE SampleTable 
ADD COLUMN LO double (percent) 

Open in new window

0
Comment
Question by:bill201
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:ChloesDad
ID: 39197891
Its as you say, although you dont need the (percent)

ALTER TABLE SampleTable ADD COLUMN LO double

Double either takes no parameters or two parameters

See here for data types http://www.w3schools.com/sql/sql_datatypes.asp
0
 

Author Comment

by:bill201
ID: 39197959
But I want it look visually like a percent
0
 
LVL 15

Expert Comment

by:ChloesDad
ID: 39197985
The formatting of the value is normally done in the user interface not in the actual field in the database, so the value in the database would be 50.0 and you would format it to show 50.0% on screen.

If you manipulate the field manually using access then you can set the format property to percent, but I dont know if you can do that in SQL.
0
 

Author Comment

by:bill201
ID: 39197991
is there some other way how to do it with vba ?
0
 
LVL 15

Accepted Solution

by:
ChloesDad earned 1500 total points
ID: 39198028
The way that I would do it is to have the number as a double in the table and then use the format function to adjust how it is displayed on screen.

Format(number,"percent")

http://msdn.microsoft.com/en-us/library/office/gg251755.aspx

Then when you are updating the table you can convert it back to a number again.
0

Featured Post

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.

Question has a verified solution.

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

In this article, we’ll look at how to deploy ProxySQL.
What we learned in Webroot's webinar on multi-vector protection.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

886 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