Results 1 to 5 of 5
  1. #1
    AccessGeek is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    19

    Inserting a New Field in Middle of Table

    To add new fields to a table I've been using something like:

    CurrentDb.Execute ("ALTER TABLE MyTable ADD COLUMN NewField(x);")



    This works fine but adds the fields to the end. Is there a way change where the field is added?

    I know that generally the field order makes no difference since I can set order in a query, but this is for an app where I have from 0-10 fields added at runtime and then display the table. Also the field names are not consistent. Any ideas?
    Thanks!

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    no, there's probably not a better way. I don't understand why you're displaying a table to a user anyway. to prove that it was created? If so, I've never seen that done elsewhere.

  3. #3
    AccessGeek is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    19
    This is an oversimplification, but its an app that mines Google Analytics Web data via export API. The user enters query parameters (metrics/dimensions) and the app returns results, which are in table format (a parsed xml actually). I could display results in a form, but I never know what parameters they are selecting so I'd have to go with unbound text boxes and set them at runtime.....which will slow things down some.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    How are you parsing the xml? Could you adjust the process to include an import of the xml or an xml conversion to a delimited text file(s) including Field names?

  5. #5
    AccessGeek is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    19
    I have a function that loops through the xml and snags values and writes them to a recordset. It does get headers. But your question makes me wonder if I should try writing the recordset differently from the begining. Thanks for getting me to relook at my process from the begining!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Inserting multiple records into a table
    By New2Access in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 09:18 PM
  2. Inserting values from one table to another
    By dada in forum Programming
    Replies: 3
    Last Post: 10-10-2010, 06:25 AM
  3. Replies: 7
    Last Post: 03-03-2010, 11:06 AM
  4. Inserting multiple rows using a value in a field
    By z1efuller1 in forum Queries
    Replies: 1
    Last Post: 01-06-2010, 11:20 AM
  5. Extract text from middle of a field
    By AccessNubie in forum Access
    Replies: 3
    Last Post: 11-02-2009, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums