Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1

    Answered: Error 3061 too few parameters. Expected 1

    Hi

    I have been reading about this error which I am getting at the moment. I have checkd the field name as far as I can... I think however that the issue is with the AND statement formulation.

    I have a button on a form which prompts for three user inputs and then should copy data from one record to another.

    however the conditions for copy are important.

    Can anyone see an issue here?

    The sql that is generated is

    INSERT INTO Software ( Hardware_ID, Software_Type, Software_Name, Version, License_Required, License_Type, Description ) SELECT '50' AS Hardware_ID, software.software_type, software.Software_Name, software.version, software.license_required, software.license_type, software.Description FROM Software WHERE (((Software.Hardware_ID) ='50') AND ((Software.Software_ID) ='265'));

    Can anyone see an issue with this?

  2. Best Answer
    Posted by Raddle

    "hey ! thanks for the super fast reply ....

    Your suggestion to learn how to use the debugger did not go unoticed from last time. That is how I was able to get the actual SQL out of the system - using a break point which has been exceedingly helpful over the last few weeks so thank you Healdem.

    In the end this was a dumb typo; software_id should have been sw_id which I have corrected and we are in TEST now. Thanks so much again

    "


  3. #2
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    For reference I get the same error if I remove the single quotes around the numberic user inputs


    INSERT INTO Software ( Hardware_ID, Software_Type, Software_Name, Version, License_Required, License_Type, Description ) SELECT 50 AS Hardware_ID, software.software_type, software.Software_Name, software.version, software.license_required, software.license_type, software.Description FROM Software WHERE (((Software.Hardware_ID) =50) AND ((Software.Software_ID) =265));

  4. #3
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    If I remove the second half of the AND statement it works but obviously is not the result that I want

    INSERT INTO Software ( Hardware_ID, Software_Type, Software_Name, Version, License_Required, License_Type, Description ) SELECT 50 AS Hardware_ID, software.software_type, software.Software_Name, software.version, software.license_required, software.license_type, software.Description FROM Software WHERE ((Software.Hardware_ID) =50) ;

  5. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Id be cautious about using an alias that is a column name
    ...SELECT 50 AS Hardware_ID,

    mind you havign said that why you feel you have to do that I dunno.. as
    INSERT INTO Software ( Hardware_ID, Software_Type, Software_Name, Version, License_Required, License_Type, Description ) SELECT Hardware_ID, software.software_type, software.Software_Name, software.version, software.license_required, software.license_type, software.Description FROM Software WHERE Software.Hardware_ID =50 AND Software.Software_ID = 265;

    is functionally the same (assuming that hardware ID and software id are both numeric

    thsi sort of wrror usually comes about becuase eitherr you haven't delimited a text/string column cvorrectly
    OR there is an unescaped ' or " in the datastream that that sends the sql engine into a brain fart.

    but the only sure way to find out is to actually examine what the SQL you are sending ACTUALLY is. and to do that you need to either put a brakpoint in the code and move the mouse over each element in the statement till you find the problem
    or worst case (you really should learn how to use the debugger if you want to develop stuff in Access, its well worth the time taken to learn what it can do for you) dump the sql statement into a message box
    I'd rather be riding on the Tiger 800 or the Norton

  6. #5
    Join Date
    Dec 2010
    Posts
    134
    Provided Answers: 1
    hey ! thanks for the super fast reply ....

    Your suggestion to learn how to use the debugger did not go unoticed from last time. That is how I was able to get the actual SQL out of the system - using a break point which has been exceedingly helpful over the last few weeks so thank you Healdem.

    In the end this was a dumb typo; software_id should have been sw_id which I have corrected and we are in TEST now. Thanks so much again


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •