Results 1 to 4 of 4
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question Run-time '3051' - Too few parameters. Expected 1


    I keep getting this error message when I try to execute the below SQL. I have been over this time and time again to no avail. Any help will be much appreciated.

    Code:
        mySQL = "UPDATE tblExportExcel SET [EmployeeName] = '" & strEmplName & "', [CurrStatus] = '" & strCurrStatus & "'," & _
            "[CurrPosition] = '" & strCurrPosition & "', [CurrLocation] = '" & strCurrLocation & "', [SelBeginDate] = #" & dtSelBeginDate & "#," & _
            "[SelEndDate] = #" & dtSelEndDate & "#, [HSLCExcptPct] = " & dblHSLCExceptPct & ", [HSLCNumExceptions] = " & lngHSLCNumExceptions & "," & _
            "[HSLCAvgHrs] = " & dblHSLCAvgHrs & ", [HSLCLastException] = #" & dtHSLCLastExcept & "#, [HSLCCity] = '" & strHSLCCity & "'," & _
            "[HSLCState] = '" & strHSLCState & "', [HSLCRegion] = " & lngHSLCRegion & ", [HSLCDistrict] = " & lngHSLCDistrict & "," & _
            "[HSLCDistrictManager] = '" & strHSLCDistrictMgr & "', [HSLCPhone] = '" & strHSLCDistPhone & "'" & _
            "WHERE [EmployeeID] = " & lngEmplID & ";"
        CurrentDb.Execute mySQL

  2. #2
    kennejd is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    188
    I don't think you need all those ' and # qualifiers in your query since you're not testing for a condition. Take those out and see what happens.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    how about this, bud:

    Code:
    "UPDATE tblExportExcel SET [EmployeeName] = '" & strEmplName & "', 
    
    [CurrStatus] = '" & strCurrStatus & "', 
    
            [CurrPosition] = '" & strCurrPosition & "', [CurrLocation] = '" & 
    
    strCurrLocation & "', [SelBeginDate] = #" & dtSelBeginDate & "#, 
    
            [SelEndDate] = #" & dtSelEndDate & "#, [HSLCExcptPct] = " & 
    
    dblHSLCExceptPct & ", [HSLCNumExceptions] = " & lngHSLCNumExceptions & ", 
    
            [HSLCAvgHrs] = " & dblHSLCAvgHrs & ", [HSLCLastException] = #" & 
    
    dtHSLCLastExcept & "#, [HSLCCity] = '" & strHSLCCity & "', 
    
            [HSLCState] = '" & strHSLCState & "', [HSLCRegion] = " & 
    
    lngHSLCRegion & ", [HSLCDistrict] = " & lngHSLCDistrict & ", 
    
            [HSLCDistrictManager] = '" & strHSLCDistrictMgr & "', [HSLCPhone] = '" 
    
    & strHSLCDistPhone & "' 
    
            WHERE [EmployeeID] = " & lngEmplID & ";"
    [/QUOTE]

    does it work?? if it doesn't sir, print it out and look at the result. such as:

    Code:
    mySQL = statement
    
    debug.print mySQL
    did you remember to do that first?? Check your quote usage too. For instance, REGION is being treated like a number. are you sure that's right?? if that particular portion is a string, it'll error.

  4. #4
    jgelpi16 is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    After some painstaking reviews and a couple colleagues looking at it.....I had mis-referenced one of my fields. Should have been [CurrLocationID] not [CurrLocation]. Thanks so much for your help!

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

Similar Threads

  1. Recordset not behaving as expected
    By jgelpi16 in forum Programming
    Replies: 4
    Last Post: 02-15-2011, 04:25 PM
  2. compile error: expected end of statement
    By RedGoneWILD in forum Programming
    Replies: 5
    Last Post: 07-29-2010, 10:12 AM
  3. Replies: 1
    Last Post: 07-10-2010, 09:56 PM
  4. Too few parameters. Expected 2.
    By PPCMIS2009 in forum Access
    Replies: 0
    Last Post: 01-28-2009, 01:02 PM
  5. Replies: 1
    Last Post: 10-15-2008, 01:25 PM

Tags for this Thread

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