Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    ConcatReated Error.

    I'm using Allen Browne's ConcatRelated Function. I've been using it for a while now with no issue. Today I'm getting the following error and I have no idea why.



    runtime error 3061 Too few parameters. Expected 1:

    Code:
    Code:
    Description: ConcatRelated("Description","concatrelated_DWI","Job_ID = " & [job_ID])
    I'm using this also and this works with no issue:

    Code:
    Description: ConcatRelated("Description","concatrelated_test","Job_ID = " & [job_ID])
    My guess is.. for what im doing right now there is nothing to concatenate. But I'm, pretty sure ive been in this situation before and its still worked using that line.


    ~Here is the full SQL:

    Code:
    SELECT Concatrelated_DWI.Site_Name, ConcatRelated("Description","concatrelated_DWI","Job_ID = " & [job_ID]) AS Description, Concatrelated_DWI.Date_Complete, Sum(Concatrelated_DWI.Cost) AS SumOfCost, Concatrelated_DWI.Job_ID
    FROM Concatrelated_DWI
    GROUP BY Concatrelated_DWI.Site_Name, ConcatRelated("Description","concatrelated_DWI","Job_ID = " & [job_ID]), Concatrelated_DWI.Date_Complete, Concatrelated_DWI.Job_ID;

    Any advice on where I should be investigating would be appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    You didn't provide the function code, but
    If the field [job_id] is null ,it could fail.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    You could try:
    Code:
    Description: ConcatRelated("Description","concatrelated_DWI","Job_ID = " & NZ([job_ID],0))
    so a NULL will be converted to a zero.

    or

    I would think [job_ID] should NEVER be NULL (is it a PK/FK field?), but you might try:
    Code:
    SELECT Concatrelated_DWI.Site_Name, ConcatRelated("Description","concatrelated_DWI","Job_ID = " & [job_ID]) AS Description, Concatrelated_DWI.Date_Complete, Sum(Concatrelated_DWI.Cost) AS SumOfCost, Concatrelated_DWI.Job_ID
    FROM Concatrelated_DWI
    WHERE Concatrelated_DWI.Job_ID IS NOT NULL
    GROUP BY Concatrelated_DWI.Site_Name, ConcatRelated("Description","concatrelated_DWI","Job_ID = " & [job_ID]), Concatrelated_DWI.Date_Complete, Concatrelated_DWI.Job_ID;
    Hard to test without examples




    BTW, "Description" is a reserved word in Access and shouldn't be used as an object name.
    I use "Desc"... but "Desc" (and "Description") are not very descriptive.... "Description" of what?
    I try to use a prefix: "ItemDesc", "JobDesc", "Job_Desc", .........

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    what is concatrelated_DWI?

    If it is a query with parameters, it can generate the error you are getting

    Also Description and Date are reserved words, so may be causing the issue

    And you are calling your concatrelated value the same as an existing field name

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Hi all,

    I appreciate your input regarding the use of reserved words. I was aware of this to be honest more recently, but since its been working for so long I haven't changed it. I'll Change the fields related to this problem and the associated querys today. Even if it doesn't fix it, its a good excuse to get it right.

    Thanks, I'll post back when I still cant fix it haha.

  6. #6
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Additionally,

    Just using some test data now and changing a few things. It's the description field that doesn't show the results. all records do have a job_ID

    Steve,
    I've put in that line. Still no joy. But it does have the job_ID so this was expected as you said.

    Ajax,
    concatrelated_DWI Is basically a filter it will only show items payable by a department named "DWI" then all other costs will be sent elsewhere. It's probably not the most elegant solution to be honest. This was done over a year ago when I was still pretty new to access.

    Lets hope I'm left alone for an hour or so now when I try to fix it! haha.

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Okay thanks for the support.

    This is now fixed.. (for no good reason as far as i can see). I was limiting all forms and query's to the selected project using this criteria: [Forms]![background form]![Project].

    I moved it from the first concat query to the second one and now all is well. The other group of querys where Im using this function work fine still when they were set up exactly the same.

    Thanks again.

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

Similar Threads

  1. Replies: 1
    Last Post: 07-26-2016, 06:34 AM
  2. Replies: 6
    Last Post: 03-17-2016, 02:10 PM
  3. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

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