![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | vbscript to alter table in msaccess I have am trying to update two tables one updates just fine but for some reason I get an error on the other. Anyway ideas what going on would be helpful. The script is dying at this line "objAccess.DoCmd.RunSQL "ALTER TABLE image ALTER COLUMN COMMENT TEXT (40)". Error below: Windows Script Host Script: C:\myfolder\script.vbs Line: 10 Char: 1 Error: Syntax error in ALTER TABLE statement. Code: 800A0CDD Source: (null) Srcipt below: Set objAccess = CreateObject("Access.Application") objAccess.AutomationSecurity = 1 ' msoAutomationSecurityLow objAccess.OpenCurrentDatabase "C:\mydatabase.mdb" Set db = objAccess.CurrentDB objAccess.DoCmd.RunSQL "ALTER TABLE mytable ALTER COLUMN FILE TEXT (50)" objAccess.DoCmd.RunSQL "ALTER TABLE mytable ALTER COLUMN FILE TEXT (50)" objAccess.DoCmd.RunSQL "ALTER TABLE image ALTER COLUMN COMMENT TEXT (40)" objAccess.AutomationSecurity = 2 ' reset |
My System Specs![]() |
| | #2 (permalink) |
| | Re: vbscript to alter table in msaccess On Jun 5, 9:12 am, jago...@xxxxxx wrote: Quote: > I have am trying to update two tables one updates just fine but for > some reason I get an error on the other. Anyway ideas what going on > would be helpful. The script is dying at this line > "objAccess.DoCmd.RunSQL "ALTER TABLE image ALTER COLUMN COMMENT TEXT > (40)". > > Error below: > > Windows Script Host > > Script: C:\myfolder\script.vbs > Line: 10 > Char: 1 > Error: Syntax error in ALTER TABLE statement. > Code: 800A0CDD > Source: (null) > > Srcipt below: > > Set objAccess = CreateObject("Access.Application") > > objAccess.AutomationSecurity = 1 ' msoAutomationSecurityLow > > objAccess.OpenCurrentDatabase "C:\mydatabase.mdb" > Set db = objAccess.CurrentDB > > objAccess.DoCmd.RunSQL "ALTER TABLE mytable ALTER COLUMN FILE TEXT > (50)" > objAccess.DoCmd.RunSQL "ALTER TABLE mytable ALTER COLUMN FILE TEXT > (50)" > objAccess.DoCmd.RunSQL "ALTER TABLE image ALTER COLUMN COMMENT TEXT > (40)" > > objAccess.AutomationSecurity = 2 ' reset it is parsed properly as a table name rather than a data type. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: vbscript to alter table in msaccess Hi Jason, Thank you for the help. It is always the little things. All is running smoothly now. Jay |
My System Specs![]() |
| | #4 (permalink) |
| | Re: vbscript to alter table in msaccess Jay wrote: Quote: > Hi Jason, > > Thank you for the help. It is always the little things. All is > running smoothly now. > > will bite you in the behind sooner or later. -- HTH, Bob Barrows |
My System Specs![]() |
| | #5 (permalink) |
| | Re: vbscript to alter table in msaccess Thank you Bob. Issues do come up when you are not paying attention. Jay. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Typed datasets and table table adapters components not showing inToolbox | .NET General | |||
| Exporting MsSQL table to Excel using vbScript? | VB Script | |||
| how do you create a dynamic table/pivot table | .NET General | |||
| Opening an MSAccess DB | .NET General | |||
| run msaccess macro from PS | PowerShell | |||