serhii.syrotynin
serhii.syrotynin

Reputation: 259

Setting default value using SQL in ms access 2007

According to w3schools I can set default value in MS Access this way:

ALTER TABLE Persons
ALTER COLUMN City SET DEFAULT 'SANDNES'

But this variant gives me

"Syntax error in ALTER TABLE instruction".

Also doesn't work:

"SANDNES"
(SANDNES)

I'm confused about that. My City Column hasn't any constraints or dependencies.

MS Access 2007. What i'm doing wrong ?

What important to mention: I should use SQL VIEW inside MS Access to set default value

Upvotes: 1

Views: 1873

Answers (1)

user3106974
user3106974

Reputation: 110

Do you have to sql for it? Otherwise do it like this:

Set a default value for a table field

  1. In the Navigation Pane, right-click the table that you want to change, and then click Design View.

  2. Select the field that you want to change.

  3. On the General tab, type a value in the Default Value property box.

  4. The value you that you can enter depends on the data type that is set for the field. For example, you can type =Date() to insert the current date in a Date/Time field.

  5. Save your changes.

Upvotes: 1

Related Questions