Try to Alter table column default value ... how ?

J

jhsi

Hi,

I am using MS ACCESS 2000. Can anyone show me what's wrong
with my below code ? I want to change the column default
value via VBA script. It's doesn't work... Thanks!


Private Sub KioskName_AfterUpdate()
Dim strSQL As String
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
strSQL = "ALTER TABLE [tbltables] ALTER COLUMN [KioskID2]
DEFAULT 'Jean'"
cnn.Execute strSQL

End Sub
 
J

Jean

Thanks!

Mark said:
Hi,

You need to include the data type even if it is the same.

i.e.


strSQL = "ALTER TABLE [tbltables] " _
& " ALTER COLUMN [KioskID2] CHAR(50) DEFAULT 'Jean';"

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/


Hi,

I am using MS ACCESS 2000. Can anyone show me what's wrong
with my below code ? I want to change the column default
value via VBA script. It's doesn't work... Thanks!


Private Sub KioskName_AfterUpdate()
Dim strSQL As String
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
strSQL = "ALTER TABLE [tbltables] ALTER COLUMN [KioskID2]
DEFAULT 'Jean'"
cnn.Execute strSQL

End Sub
 

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