Solved

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

Posted on 2013-05-26
5
761 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 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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…

770 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