Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

743 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

15 Experts available now in Live!

Get 1:1 Help Now