SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru Wullie's Avatar
    Join Date
    Oct 2002
    Location
    Greenock, Scotland
    Posts
    701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MS Access Data Definition Query

    Im trying to create a data definition query in MS Access 2002. Its a real simple example but I cant seem to work out how I can pass a parameter. Ive included the code without a parameter adn the code how I expected it to work. Any ideas what I should do or am doing wrong?

    Simple Working
    *----------------------------------
    ALTER TABLE tblSubscriberInfo
    ADD fieldName Text ( 255 )
    *--------------------------------


    Not Working
    *----------------------------------
    PARAMETERS strFieldName Text ( 255 );
    ALTER TABLE tblSubscriberInfo
    ADD [strFieldName] Text ( 255 )
    *--------------------------------
    ASP.NET Freelance Web Developer
    Bored? Check out my photography folio at Flickr

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're trying to dynamically add a text field to a table, with the field name specified as a parameter? Not going to work. You need the expression to end up as this:
    Code:
    ALTER TABLE tblSubscriberInfo 
    ADD NewFieldName Text (255)
    But your code ends up as this:
    Code:
    ALTER TABLE tblSubscriberInfo 
    ADD "NewFieldName" Text (255)
    (which is not the right syntax)

    I doubt it can be done, to be honest.
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •