Concatenate values from related records - not working (1 Viewer)

Wozza

New member
Local time
Today, 21:09
Joined
May 19, 2020
Messages
13
Hi, I am using Allen Browne's function to try and concatenate values from a related record in a form. However, the concatenated field is not working properly.
This is the table
1614264949771.png
So I need 20FUN02 - JCM, ICFO. In the form, it is coming up as

1614265022862.png


The code for the guarantee list is :
=ConcatRelated("LE_shortname","MT_guarantee_list","REF= " & "[ref]")

The list does not even match the ref, it appears for all records. Any help would be gratefully received.

Many thanks
 

Minty

AWF VIP
Local time
Today, 21:09
Joined
Jul 26, 2013
Messages
10,368
Take the quote away from the second ref - you aren't creating the criteria correctly.

ConcatRelated("LE_shortname","MT_guarantee_list","REF= '" & [ref] & "'")
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:09
Joined
Oct 29, 2018
Messages
21,454
Hi. Just for future reference, you might care to take a look at this simple function as well. Cheers!

 

Wozza

New member
Local time
Today, 21:09
Joined
May 19, 2020
Messages
13
Take the quote away from the second ref - you aren't creating the criteria correctly.

ConcatRelated("LE_shortname","MT_guarantee_list","REF= '" & [ref] & "'")
Feel like I'm so close! It's now coming up with this....

1614268110104.png
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:09
Joined
Oct 29, 2018
Messages
21,454
Thank you. Yes I will take a look. :)
If you do give it a try, maybe you could start with something like this.
Code:
SimpleCSV("SELECT LE_shortname FROM MT_guarantee_list WHERE REF='" & [Ref] & "'")

Edit: For some reason, the forum software wouldn't let me finish the above code. I need to insert a double quote + single quote + double quote just before the closing parens.

Edit2: Ah, never mind. It finally let me do it. Cheers!
 

Wozza

New member
Local time
Today, 21:09
Joined
May 19, 2020
Messages
13
If you do give it a try, maybe you could start with something like this.
Code:
SimpleCSV("SELECT LE_shortname FROM MT_guarantee_list WHERE REF='" & [Ref] & "'")

Edit: For some reason, the forum software wouldn't let me finish the above code. I need to insert a double quote + single quote + double quote just before the closing parens.

Edit2: Ah, never mind. It finally let me do it. Cheers!
Hi, I used your function and the code your suggested but still keep geeting the #name? error

1614270515412.png
 

Minty

AWF VIP
Local time
Today, 21:09
Joined
Jul 26, 2013
Messages
10,368
Try it in a query first. Then use that as the basis for your form.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 13:09
Joined
Oct 29, 2018
Messages
21,454
Hi, I used your function and the code your suggested but still keep geeting the #name? error

View attachment 89530
Hi. A #Name? error typically means there was a typo. Please double check the expression you used to check for misspellings and make sure you didn't name the module the same as the function. For example, I use modDBguy.
 

Wozza

New member
Local time
Today, 21:09
Joined
May 19, 2020
Messages
13
Try it in a query first. Then use that as the basis for your form.
Yes, I got it to work in the query. I did need to put in the table name though for it to work. 'SimpleCSV("SELECT LE_shortname FROM MT_guarantee_list WHERE REF='" & [MTR_Proj_info].[Ref] & "'"). ow to try and get it working in the form. Thank you so much for your help
 

Users who are viewing this thread

Top Bottom