Results 1 to 5 of 5
  1. #1
    scott0_1 is offline Advanced Beginner
    Windows Vista Access 2013 32bit
    Join Date
    Apr 2018
    Posts
    82

    Runtime error 3061 - Too few parameters. Expected 2. ---- WHY????

    Hello,



    I'm running the following query, which I used the query builder to help with:

    Code:
    UPDATE tblPositionNumbers SET tblPositionNumbers.CostCentre = [tblImportTMP].[F3] WHERE [tblPositionNumbers].[PositionNumber]=[tblImportTMP].[F2];
    This should be the easiest query to run ever, but I'm getting an error say that it is expecting two parameters.

    The preceding code grabs data from an Excel sheet and puts it into a table in Access. I've checked the table; there is data. The data in the columns is correct.

    I use very similar code to insert new lines into the tblPositionNumbers table and it works fine.

    Can anyone see what I'm missing here?

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Without seeing the underlying data sources it's impossible to pinpoint the problem exactly. I can tell you that the message means that 2 parameters cannot be resolved. What we can't say for sure is why. Often, it's a spelling problem but sometimes it's a reference problem; i.e. the path to the source fields can't be resolved. This could be any of a myriad of reasons, such that the source isn't open (when it's a form, for example). Suggest you copy this sql to a new query in sql view then switch to datasheet view (so that the query won't actually run but will process the sql) and see what happens. I'd expect the sql view to highlight the offending part (but one at a time). You could also just view this in design view and see if it makes sense. Perhaps your source reference doesn't appear in the design, but should.
    EDIT
    The table that holds this ([tblImportTMP].[F3]) and the other reference should be there.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    The message is telling you there are 2 items it cannot resolve

    1. For this to work you need to explicitly include both tables

    Code:
    UPDATE tblPositionNumbers INNER JOIN tblImportTMP ON [tblPositionNumbers].[PositionNumber]=[tblImportTMP].[F2] SET tblPositionNumbers.CostCentre = [tblImportTMP].[F3];
    2. If its a SQL statement in code, you also need text or number delimiters around the F3 part depending on the datatype for F3
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    scott0_1 is offline Advanced Beginner
    Windows Vista Access 2013 32bit
    Join Date
    Apr 2018
    Posts
    82
    Quote Originally Posted by ridders52 View Post
    The message is telling you there are 2 items it cannot resolve

    1. For this to work you need to explicitly include both tables

    Code:
    UPDATE tblPositionNumbers INNER JOIN tblImportTMP ON [tblPositionNumbers].[PositionNumber]=[tblImportTMP].[F2] SET tblPositionNumbers.CostCentre = [tblImportTMP].[F3];
    2. If its a SQL statement in code, you also need text or number delimiters around the F3 part depending on the datatype for F3
    Bingo on the inner join!

    Thanks for the help!

  5. #5
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You're welcome.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

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

Similar Threads

  1. Run-Time Error '3061: Too few parameters. Expected 2.
    By Rickochezz in forum Import/Export Data
    Replies: 1
    Last Post: 11-01-2016, 07:29 AM
  2. Error 3061. Too few parameters. Expected 1.
    By Glenn_Suggs in forum Programming
    Replies: 5
    Last Post: 02-03-2015, 12:03 PM
  3. Runtime Error 3061. Too few parameters, expected 2
    By Gina Maylone in forum Programming
    Replies: 35
    Last Post: 01-13-2014, 02:37 PM
  4. Replies: 3
    Last Post: 04-26-2013, 01:37 PM
  5. 3061 Error. Too few parameters. Expected 1.
    By rghollenbeck in forum Queries
    Replies: 5
    Last Post: 09-28-2011, 12:12 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