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

  • Thread starter Thread starter jhsi
  • Start date Start date
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
 
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
 
Back
Top