none
error 3061: too few parameters RRS feed

  • Question

  • I've created an Append Action Query. When I run the Query when form "[Forms]![frmBoQ_Entry_Edit]"is opened and there's already a record, it executes correct and adds required records in sub form/table. But when i use the same query for a new record, which is basically what i want, in an After Update event in a parent form using CurrentDB.Execute, it shows me Run-time error '3061': Too few parameters. Expected 1.

    What little about debugging i know, i tried to no avail.

    Below is a the query, but I'm also uploading the related part of the database for anybody willing to help please. https://drive.google.com/file/d/0B40aEpxbK6NfZUlIbGRoOFBJOTQ/view?usp=sharing


    Thanks

    INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity )
    SELECT tblBoQ.ID, tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity
    FROM (tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID
    WHERE (((tblROC_Activities_Steps.InstallationTypeID)=[Forms]![frmBoQ_Entry_Edit]![InstallationTypeID]));

    Sunday, September 27, 2015 10:58 AM

Answers

  • Hi KhurramKZ,

    This message you typically get when one of the parameters can not be found. I expect [Forms]![frmBoQ_Entry_Edit]![InstallationTypeID] to be the one, when the form is not open.

    You can try something like:

    DoCmd.Execute "INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity )
     SELECT tblBoQ.ID, tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity
     FROM (tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID
     WHERE (((tblROC_Activities_Steps.InstallationTypeID)= " & my_new_id

    where you supply the parameter-value to the sql-string.

    Imb.

    • Marked as answer by KhurramKZ Monday, September 28, 2015 3:43 AM
    Sunday, September 27, 2015 11:16 AM
  • Try this:

        CurrentDb.Execute "INSERT INTO tblBoQ_Progress (BoQID, Step, Activity) SELECT tblBoQ.ID, " & _
            "tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity FROM " & _
            "(tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON " & _
            "tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) " & _
            "INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID " & _
            "WHERE tblROC_Activities_Steps.InstallationTypeID=" & Me.InstallationTypeID


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by KhurramKZ Monday, September 28, 2015 3:44 AM
    Sunday, September 27, 2015 11:43 AM

All replies

  • Hi KhurramKZ,

    This message you typically get when one of the parameters can not be found. I expect [Forms]![frmBoQ_Entry_Edit]![InstallationTypeID] to be the one, when the form is not open.

    You can try something like:

    DoCmd.Execute "INSERT INTO tblBoQ_Progress ( BoQID, Step, Activity )
     SELECT tblBoQ.ID, tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity
     FROM (tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID
     WHERE (((tblROC_Activities_Steps.InstallationTypeID)= " & my_new_id

    where you supply the parameter-value to the sql-string.

    Imb.

    • Marked as answer by KhurramKZ Monday, September 28, 2015 3:43 AM
    Sunday, September 27, 2015 11:16 AM
  • Try this:

        CurrentDb.Execute "INSERT INTO tblBoQ_Progress (BoQID, Step, Activity) SELECT tblBoQ.ID, " & _
            "tblROC_Activities_Steps.Step, tblROC_Activities_Steps.Activity FROM " & _
            "(tblROC_InstallationType INNER JOIN tblROC_Activities_Steps ON " & _
            "tblROC_InstallationType.ID = tblROC_Activities_Steps.InstallationTypeID) " & _
            "INNER JOIN tblBoQ ON tblROC_InstallationType.ID = tblBoQ.InstallationTypeID " & _
            "WHERE tblROC_Activities_Steps.InstallationTypeID=" & Me.InstallationTypeID


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by KhurramKZ Monday, September 28, 2015 3:44 AM
    Sunday, September 27, 2015 11:43 AM
  • Thank you, it worked.
    Monday, September 28, 2015 3:44 AM