Results 1 to 3 of 3
  1. #1
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154

    Adding a column to an Access table in using Access VBA

    I get an error when I try to add a column to a table in Access using the VBA code below:



    Click image for larger version. 

Name:	Capture.PNG 
Views:	8 
Size:	6.6 KB 
ID:	37734

    The error I get is "The query is a DDL query and cannot be used as a row source"

    What am I doing wrong?

  2. #2
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    154
    Silly me, I removed the recordset part from my code and just used CurrentDb.execute(sql) and it worked

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    tho you wouldn't really need to add columns to a table via code when you can just design it and add it manually.

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

Similar Threads

  1. Replies: 15
    Last Post: 02-03-2018, 09:57 PM
  2. Replies: 4
    Last Post: 07-26-2016, 02:39 AM
  3. Adding column(s) to a table
    By Zekii61 in forum Access
    Replies: 5
    Last Post: 10-06-2013, 10:18 PM
  4. Replies: 4
    Last Post: 09-04-2013, 06:40 AM
  5. Adding new column to make-table query
    By dtn118 in forum Access
    Replies: 2
    Last Post: 08-03-2008, 06:51 AM

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