473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot get ConcatRelated() Function to work

3
Using Allen Browne's ConcatRelated()Function

Have tbl that looks like:
Expand|Select|Wrap|Line Numbers
  1. Prgm    Level No    Target
  2. 3801    300104      983
  3. 3801    300104      106
  4. 3801    300104      1026
  5. 3801    550201      1027
  6. 3801    550201      127
  7. B4X     200407      1518
  8. B4X     200407      2898
  9. B4X     200407      2299
  10. B4X     200407      22
  11. ABC     150401      339
Wanting to get these results:
Expand|Select|Wrap|Line Numbers
  1. Prgm    Level No    PossibleTrgts
  2. 3801    300104      983, 106, 1026
  3. 3801    550201      1027, 127
  4. B4X     200407      1518, 2898, 2299, 22
  5. ABC     150401      339
Using this query:
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Tbl.[Prgm], Tbl.[Level No], ConcatRelated([Target],"Tbl","[Prgm]=""" & [Prgm] & """" And [Level No]=""" & [Level No] & """") AS PossibleTrgts
  2. FROM Tbl;
Using MS Access 2010 32bit
Prgm and Level No fields are text
Target field is number


Getting error message: Syntax error in string in query expression 'ConcatRelated([Target],"Tbl","[Prgm]=""" & [Prgm] & """" And [Level No]=""" & [Level No] & """") AS PossibleTrgts
FROM Tbl;'.


Would appreciate any help in this matter using 2 fields.
Jul 30 '15 #1
6 8173
Seth Schrock
2,965 Expert 2GB
Try the following
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Tbl.[Prgm]
  2. , Tbl.[Level No]
  3. , ConcatRelated("[Target]","Tbl","[Prgm]='" & [Prgm] & "' And [Level No]='" & [Level No] & "'") AS PossibleTrgts
  4. FROM Tbl;
Jul 30 '15 #2
Rabbit
12,516 Expert Mod 8TB
I'm pretty sure Target needs to be in quotes as well.
Jul 30 '15 #3
Seth Schrock
2,965 Expert 2GB
@ Rabbit You are correct about that. I missed that originally.
Jul 30 '15 #4
yosko1
3
@Seth Schrock
Still get syntax error msg. After clicking on OK button the query is highlited in black from: "') AS PossibleTrgts
FROM Tbl;

This still after adding quotes to "[Target]"
Jul 30 '15 #5
Seth Schrock
2,965 Expert 2GB
I have added another missing double quote right before the ending parenthesis. Try my code from post #2 again.
Jul 30 '15 #6
yosko1
3
Thank you Seth and Rabbit for your help. Got compile error but once I fixed that, it's working now. Thank you again for your quick response and consideration in this matter.
Jul 31 '15 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: KathyB | last post by:
Hi, I've tried everything I can think of. Using the script below, I thought on submit my ConfirmSave function would run, then if true returned, would run my form action. At this point it appears...
16
by: Geoff Cox | last post by:
Hello, Can someone please explain how this preload images function works? It is the picture.onload = preload_imgs; which I don't understand.
42
by: Martin Jørgensen | last post by:
Hi, I'm trying to move a matlab program into c language. For those who knows matlab, this is the line I want to program in c: hx(1:nx,1:ny) = 0; % nx=10, ny=10 It works on a 2-dimensional...
2
by: sam.barker0 | last post by:
Hi , I am having 3 functions.When I step through when func b returns to funca.it throws an error "cannot find function bounds" funca() { .... ... funcb(); }
6
by: Ken Jones | last post by:
With 2 separate character strings of 100038_ko and 244p_po how do I strip off the _ko and _po from the respective strings?
1
by: DavidSS | last post by:
Okay, I have a problem. I just started programming, and made my first "calculator" I then started making it more advanced, so it wouldn't crash if you tried to divide by 0. Then I wanted to make...
11
by: Michelle Murphy | last post by:
Hi, I'm very rusty at this, been awhile. I have a table that looks like this: Angell 10 Angell 70 Angell 96 Cook 12 Cook 15 Cook 22 Cook 25
4
by: whodgson | last post by:
the following is a small program from Brian Overland`s book "C++ In Plain English" It converts a number from decimal format to binary format as an example of bit shifting. My problem is that i...
1
by: kkshansid | last post by:
access 2007 i created the report went to view code option copy pasted the code of function code on new module but when i call the function in report it gives error enter parameter value but...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.