Results 1 to 9 of 9
  1. #1
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419

    programmatically add a field, or delete a field not by name but by index


    Hello,

    I have the other way which is to add or delete a field by it's name but can someone show me an example
    on how to add or delete a field from a table by it's index ?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you normally dont delete fields.
    you delete the value from the field.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    on how to add or delete a field from a table by it's index ?
    don't think you can, the alter table sql uses field name, not an index

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    John,

    Help readers help you. Give us some info on what you want to accomplish and why(business rationale).
    Rarely would you have a "normal process" to alter a table design programmatically in an operational system. When designing and/or developing you may have fields in tables that you determine are not required, and remove them before moving the application to production status. Even then you would normally go to design view of table and remove field. The need for programmatic manipulation of a table design in an operational system raises a red flag.

  5. #5
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    Hi Orange,

    Thanks for the informative information. Yes it does raise a red flag however in my situation there is a need to do this because the fields are change by the user as the business reporting wants to see that particular fields on different occasions and a static database when doesn’t have that field can’t satisfy the user that wants to see it. I’m giving power to the user that wants to see what they want to see. I just use the name instead of index because I don’t think we can do it by index.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I would suggest you get the user to layout the types of business reporting that are required.
    Then create a series of reports that could be executed via selection from a form and combo i dentifying those reports.

    You might get some ideas from Martin Green's Dynamic Reports.

  7. #7
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    That’s a very good idea.
    I will do that also. Sometimes just unpredictable what report and field is needed. But I like your way and will do that too. I like to use access as a repository and storage but if I am not wrong, I think the maximum is 20 GB of data it can hold.

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    I think the maximum is 20 GB
    No, 2Gb. If you use sql server express it is 10Gb, sql server much more

  9. #9
    johnseito is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2013
    Posts
    419
    I like different ideas and ways. That’s a very nice article from Martin Green on dynamic reports. I will look at it.

    Ajax thanks for enlighten me. 👍

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

Similar Threads

  1. Loading a OLE field programmatically
    By josekreif in forum Programming
    Replies: 4
    Last Post: 03-08-2016, 05:24 PM
  2. Text field refuses to change programmatically
    By kdbailey in forum Access
    Replies: 6
    Last Post: 03-08-2014, 02:32 PM
  3. Replies: 5
    Last Post: 01-14-2013, 03:04 PM
  4. how to retrieve a value from a field by index?
    By RedGoneWILD in forum Programming
    Replies: 6
    Last Post: 07-14-2012, 04:48 PM
  5. Programmatically add a field to an existing table
    By lpdds in forum Database Design
    Replies: 2
    Last Post: 11-10-2009, 12:45 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