Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Getting error with table update

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason - 09 May 2008 09:47 GMT
db.Execute "ALTER TABLE [" & vTableName & "] ALTER COLUMN [" & vFieldName &
"] TEXT (" & vParameters & ")"  'change field size

where vParameters = 10
Gives Run-time error '3293'
Syntax error in ALTER TABLE statement

The field is created with field size =255 but not 10
Steve Sanford - 10 May 2008 06:18 GMT
Jason,

I am using A2K/ WinXP

I used your SQL and I did not get an error. I changed the field from 50 to
10, then to 55, then to 35..... no errors.

Are you using any special chars in the table name or field name???
Is the column you are trying to alter TEXT??

Try changing your code to:

Dim sSQL as string

  ' this should be one line
  sSQL = "ALTER TABLE [" & vTableName & "] ALTER COLUMN [" & vFieldName &
"] TEXT (" & vParameters & ")"

 ' find out what is in the string sSQL
 Debug.Pring sSQL

  db.Execute sSQL, dbFailOnError

Set a breakpoint on the "db.Execute" line and post back with the sSQL
results (from the immediate window)

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> db.Execute "ALTER TABLE [" & vTableName & "] ALTER COLUMN [" & vFieldName &
> "] TEXT (" & vParameters & ")"  'change field size
[quoted text clipped - 4 lines]
>
> The field is created with field size =255 but not 10
Jason - 10 May 2008 06:31 GMT
No special text just the number 10. No special text in fieldname - just the
letters A to Z
What do you mean by Is the column you are trying to alter TEXT??
Text was on one line - OE craps entries made here

> Jason,
>
[quoted text clipped - 32 lines]
> >
> > The field is created with field size =255 but not 10
Jason - 10 May 2008 09:19 GMT
Text is ALTER TABLE [PreviousAddress] ALTER COLUMN [Address1] TEXT (20)
Table = PreviousAddress
Fieldname = Address1
Text Field Length = 20

Select Case vPropertyType
       Case "Text Field Size ="

> Jason,
>
[quoted text clipped - 32 lines]
> >
> > The field is created with field size =255 but not 10
Peter Hibbs - 10 May 2008 12:04 GMT
Jason,

I have also tried it and it works OK (which is not really surprising
as it is my code you are using). However, I noticed on one of your
other posts that you are using Access 97 and I am wondering if this is
the problem. I know that Microsoft made quite a few enhancements to
the SQL Jet Engine between versions 97 and 2000 and it may be that the
ALTER COLUMN function did not have this facility on the earlier
version. Also, looking at my old Access 97 books, I don't see any
commands to change the field size. Maybe someone else has more info on
the changes made.

Is it possible for you to try the code out with Access 2000 (or later)
to see if it works then.

There is some information on SQL 97 at :-
http://www.personal.kent.edu/~gthomas/sql/sqldoc.htm#altertable
No mention of changing the field size on an existing field, although
you can set the field size when adding a new field to a table. You
could delete the field with the DROP command and then add it in again
but you would lose any data in the field (which would not be a good
idea).

Also this site has more information on SQL 2000 which may be useful :-
http://www.personal.kent.edu/~gthomas/sql/sqldoc.htm#altertable

HTH

Peter Hibbs.

>db.Execute "ALTER TABLE [" & vTableName & "] ALTER COLUMN [" & vFieldName &
>"] TEXT (" & vParameters & ")"  'change field size
[quoted text clipped - 4 lines]
>
>The field is created with field size =255 but not 10
Jason - 10 May 2008 21:15 GMT
It is during the add command where it fails. Access 2000 file in Access 2003
works. So How can I add text fields in 97 (That is the run time version I
have otherwise I would use 2003).
From the form:
Action: New Field
Table Name: PreviousAddress
FieldName: Address3
Field Type: text
Property: Text Field Size=
Additional Data: 10

> Jason,
>
[quoted text clipped - 34 lines]
> >
> >The field is created with field size =255 but not 10
Peter Hibbs - 10 May 2008 21:55 GMT
Jason,

Don't know, if it is failing because the Run Time version is Access 97
then I don't see what else you can do (apart from upgrade of course).
What I would do is allow the field to be added with a field size of
255 and then change the code in the front end file to limit the number
of characters entered in the field to 10. You could do this by setting
the Input Mask property on the form or, perhaps, setting a Validation
Rule or maybe write some VBA code to limit the input.

Peter Hibbs.

>It is during the add command where it fails. Access 2000 file in Access 2003
>works. So How can I add text fields in 97 (That is the run time version I
[quoted text clipped - 46 lines]
>> >
>> >The field is created with field size =255 but not 10
Jason - 10 May 2008 23:54 GMT
Wouldn't that inflate the file size? I would upgrade but too expensive for
me.
> Jason,
>
[quoted text clipped - 58 lines]
> >> >
> >> >The field is created with field size =255 but not 10
John W. Vinson - 11 May 2008 00:26 GMT
>Wouldn't that inflate the file size?

No. Access does not store trailing blanks. A Text(10) field and a Text(255)
field occupy exactly the same space if each contains ten characters.

>I would upgrade but too expensive for me.

A97 can change table definitions - using VBA code; it just doesn't support DDL
queries in the same way that later versions do.
Signature


            John W. Vinson [MVP]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.