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

    How to poupulate a blank column in an access table


    I am trying to populate a column called "Entity" in my access table with the value "Dog".
    Here is my VBA code in Access:


    Click image for larger version. 

Name:	Capture.PNG 
Views:	10 
Size:	13.1 KB 
ID:	37735

    but I get an error saying cannot execute a select query.
    Does anyone have experience in writing such queries in access vba?

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    create a query to update the records.

    First create a select query that will return all records you with to update. Criteria in the entity field would be "is null".

    Once you are happy the query is returning the results you want to update, click update on the design tab and add what you want to update it too.

    Any problems let us know.

    Andy

  3. #3
    mp3909 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    136
    thanks Andy, that did the trick!

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    A bit more info......

    You can only "Execute" action queries. Action queries are Insert, Update and Delete queries. SELECT is NOT an action query.


    Also, you used "SQL" as a variable name in your code. Note that "SQL" is a reserved word in Access and shouldn't be used as object/variable names.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2014, 02:38 PM
  2. Replies: 4
    Last Post: 09-04-2013, 06:40 AM
  3. Replies: 17
    Last Post: 08-27-2013, 10:21 PM
  4. Blank column causing errors on import
    By brickballer in forum Import/Export Data
    Replies: 7
    Last Post: 05-20-2011, 12:54 PM
  5. ODBC table read to blank Access table write
    By dibblejon in forum Access
    Replies: 2
    Last Post: 03-10-2010, 08:39 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