473,387 Members | 1,812 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,387 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 8174
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.