Results 1 to 5 of 5
  1. #1
    Sitakanta1989 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    2

    Subquery Inside Insert query statement

    Hi All,



    I am using a subquery to take a value inside a insert query. But it is saying "[HY000:-3035: on SQLHANDLE] [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query."


    insert into SC_789
    (User_ID,Date_Time,Store_ID,Period_txt,Role,Role_F unctionality,Comment_Category,Comment_Subcategory, Remarks)
    values
    ( 'Administrator', getdate(), 'BE1001','2014S1','CFO',

    Select ([Role_Functionality]) from Transaction_Dropdown where [Comment_Subcategory] = 'Close down',
    select ( [Comment_Category]) from Transaction_Dropdown where [Comment_Subcategory] = 'Close down',

    'Close down', 'No Comments' );


    Please help me to identify the issue and provide a sloution if possible

    Thanks,
    Sitakant

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,523
    If you linked more than 1 table in the query , it could prevent the update. It depends on the arrangement.
    or if the table link is not ddynaset
    or the table

  3. #3
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,041
    Hi,
    looking at the getdate() function in the statement it looks to me you're using SQL server syntax. Could you specify a bit in what environment you are working? Access front-end on SQL server back-end?

  4. #4
    Sitakanta1989 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    2
    Quote Originally Posted by NoellaG View Post
    Hi,
    looking at the getdate() function in the statement it looks to me you're using SQL server syntax. Could you specify a bit in what environment you are working? Access front-end on SQL server back-end?


    Hi,

    I am using Access front-end and getdate() is replaced by date(). But still the query is throwing error in the subquery part. Is it possble to pass a value from different table in a insert query ?

    Thanks,
    Sitakant

  5. #5
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,041
    Hi,

    yes but you have to use a dlookup function, something like

    dlookup("[Role_Functionality]","Transaction_Dropdown", "[Comment_Subcategory] = 'Close down'")

    keep in mind that using subqueries is always slower than using joined tables.



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

Similar Threads

  1. Replies: 6
    Last Post: 03-09-2013, 10:44 AM
  2. Maybe subquery with IIF statement
    By tmcrouse in forum Queries
    Replies: 2
    Last Post: 01-25-2012, 12:43 PM
  3. Subquery and IIF statement
    By ksamaniego in forum Queries
    Replies: 1
    Last Post: 08-15-2011, 03:17 PM
  4. INSERT INTO ... SELECT Subquery
    By TheDeceived in forum Programming
    Replies: 1
    Last Post: 10-19-2010, 09:29 AM
  5. Replies: 4
    Last Post: 09-03-2010, 02:55 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