Alter Table: datatype

J

Jochem Davids

Hi fellow Access-coders ;x

To add a column_name with datatype, you use:
ALTER TABLE table_name
ADD column_name datatype

To add a column Id with AUTOINCREMENT, you use:
ALTER TABLE table_name
ADD COLUMN Id
AUTOINCREMENT

Now I want to add a column, Year with the present Year. And a column with
the present month 1 (January), 2 (February) etc. (Just the 1,2,3 etc will
do).

Can anybody help me with this??



Ps. It is possible to use the year and moth from my Form1, and start the Sql
with a Macro (RunSql).
 
S

strive4peace

Why do you want to add these columns to your table?

Year --> year(date_expression)
Month--> month(date_expression)

where date_expression -->
1. date fieldname
2. date controlname
3. variable name
4. equation that evaluates to a date


Warm Regards,
Crystal
Microsoft Access MVP 2006

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top