Solved

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

Posted on 2013-05-26
5
824 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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