Results 1 to 14 of 14
  1. #1
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13

    Insert into Error = Too few parameters. HELPPP

    Hello,
    I'm hoping some of the programming gurus will be able to help this newbie with her code.


    I am trying to insert values from a form into a temp table I have created. I have the columns correct in the statement but I still getting this error. I watch this video on Youtube that helped me alot by something is up with my coding.
    http://www.youtube.com/watch?v=BH_LNnNuK-k


    Error:
    Run-Time error '3601'
    Too Few parameters. Expected 1.

    Code:
    'add data to table
    CurrentDb.Execute "INSERT INTO METAFIELDS_TEMP_TABLE(DB_SCH, DB_OBJ_NAME, DB_COL_NAME, BIZ_NAME, BIZ_DEF, DRVD_IND, BIZ_LOGIC, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE) " & _
    " VALUES(" & Me.addSch & ",'" & Me.addTable & "','" & Me.addCol & "','" & Me.addBizName & "','" & _
    Me.addBizDef & " ','" & Me.addDrvd & "','" & Me.addBizLogic & "','" & Me.addDataLength & "','" & Me.addDataType & "','" & _
    Me.addPrecision & "','" & Me.addDataScale & "','" & Me.addNullable & "');"

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,531
    Here's a commonly used method to debug SQL built in code:

    BaldyWeb-Immediate window
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    Thanks I put the SQL in a new query and i figured out that the order of my columns were incorrect. When I ran the query it works great BUT when I insert it into the Click() area i still keep getting the same error.
    CurrentDb.Execute "INSERT INTO METAFIELDS_TEMP_TABLE(DB_SCH, DB_OBJ_NAME, DB_COL_NAME, BIZ_NAME, BIZ_DEF, DRVD_IND, BIZ_LOGIC, " & _
    "DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE) " & _
    "VALUES(" & Me.addSch & ",'" & Me.addTable & "','" & Me.addCol & "','" & Me.addBizName & "','" & Me.addBizDef & "','" & _
    Me.addDrvd & "','" & Me.addBizLogic & "','" & Me.addDataType & "','" & _
    Me.addDataLength & "','" & Me.addPrecision & "','" & Me.addDataScale & "','" & Me.addNullable & "')"

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,531
    What is the result of the Debug.Print suggested in my first response?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,974
    Are all those fields using apostrophe delimiters really text type?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    No there are 3 fields DataLength, DataPrecision and DataScale that are numeric. Guess I'm missing something there huh?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,974
    Number fields do not use delimiters, remove the apostrophes. Same for boolean (yes/no). Date fields need # delimiter for values.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    so how would I code the DataLength, DataPrecision and DataScale in my statement?

    "VALUES(" & Me.addSch & ",'" & Me.addTable & "','" & Me.addCol & "','" & Me.addBizName & "','" & Me.addBizDef & "','" & _
    Me.addDrvd & "','" & Me.addBizLogic & "','" & Me.addDataType & "','" & _
    Me.addDataLength & "','" & Me.addPrecision & "','" & Me.addDataScale & "','" & Me.addNullable & "')"


  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,974
    Just remove the apostrophes for those three variables, like you have Me.addSch without apostrophes.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    Still getting the error too few parameters Expect 2. SMH

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,974
    I suspected that would happen but those were errors that would need fix anyway. I can't see anything wrong with the query syntax.

    Post the exact output of the Debug.Print.

    Otherwise, don't think we can help unless you want to provide db for analysis. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    VeganLiving is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2013
    Posts
    13
    HELP!!!I have debugged and i'm still getting the same error. Can anyone see anything in the syntax that could be off? I have checked the column names, ran the sql by itself and it ran fine. 3 fields are numeric and the rest are not.

    Error:
    Run-Time error '3601'
    Too Few parameters.

    CurrentDb.Execute "INSERT INTO METAFIELDS_TEMP_TABLE(DB_SCH, DB_OBJ_NAME, DB_COL_NAME, BIZ_NAME, BIZ_DEF, DRVD_IND, BIZ_LOGIC, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE) " _
    & "Values(" & Me.addSch & ", " & Me.addTable & "," & Me.addCol & ",'" & Me.addBizName & "','" & Me.addBizDef & "', " _
    & Me.addDrvd & ",'" & Me.addBizLogic & "'," & Me.addDataType & "," & Me.addDataLength & "," & Me.addPrecision & ", " _
    & Me.addDataScale & "," & Me.addNullable & ");"

  13. #13
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,531
    I guess it's time to ask again for the results of the Debug.Print. If you want to learn how to fish, that is an important tool in sorting out these types of problems.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,974
    If only 3 fields are number why are 9 fields now set up as number?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  2. Error 3061 Too Few parameters
    By gopherking in forum Programming
    Replies: 5
    Last Post: 10-06-2011, 11:50 AM
  3. Replies: 3
    Last Post: 07-23-2011, 08:34 AM
  4. Too few parameters error.
    By stupesek in forum Forms
    Replies: 5
    Last Post: 09-15-2010, 09:27 AM
  5. Why am I getting error: too few parameters?
    By cowboy in forum Programming
    Replies: 3
    Last Post: 03-24-2010, 10:13 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