- Local time
- Yesterday, 22:15
- Joined
- Oct 29, 2018
- Messages
- 22,771
Hi Ron,Please find a condense version of the DB
Please pardon me for jumping in. Please see attached modified version of your db and open qrySimpleCSV. Hope that helps...
Hi Ron,Please find a condense version of the DB
This works:
Code:strSQL = "Select AgencyName FROM tblReportID INNER JOIN (tblRecommendations INNER JOIN tblAgencyAssigned " & _ "ON tblRecommendations.RECID = tblAgencyAssigned.RecID) ON tblReportID.ReportID = tblRecommendations.ReportID " & _ "WHERE tblReportID.ReportID = '" & [Forms]![frmReviewReportID]![ReportID] & "'"
This works:
Code:strSQL = "Select AgencyName FROM tblReportID INNER JOIN (tblRecommendations INNER JOIN tblAgencyAssigned " & _ "ON tblRecommendations.RECID = tblAgencyAssigned.RecID) ON tblReportID.ReportID = tblRecommendations.ReportID " & _ "WHERE tblReportID.ReportID = '" & [Forms]![frmReviewReportID]![ReportID] & "'"
Hi. If you try my example, just add the DISTINCT keyword to the SELECT statement. For example,T
Thank you this worked, as did the solution by the DBguy. I will try to use this example as I can understand it a bit clearer. However I still have one issue, if the same agency is assign to a ReportID more than once it displays serval times in the field. Is there a way we can not show duplicate strings.
View attachment 83552
This works:
Code:strSQL = "Select AgencyName FROM tblReportID INNER JOIN (tblRecommendations INNER JOIN tblAgencyAssigned " & _ "ON tblRecommendations.RECID = tblAgencyAssigned.RecID) ON tblReportID.ReportID = tblRecommendations.ReportID " & _ "WHERE tblReportID.ReportID = '" & [Forms]![frmReviewReportID]![ReportID] & "'"
Yes but not sure I was putting it in the right place as I couldn't get it to workDid you try DISTINCT?
Did you see my last post?Yes but not sure I was putting it in the right place as I couldn't get it to work
Yes thankyou it is working now, I am just trying to work out why it is showing a comer at the start, the code lineDid you see my last post?
If strtext = " " Then
strtext = rs!AgencyName
Else
strtext = strtext & ", " & rs!AgencyName
End If
Hi. Does my demo show a comma at the beginning too? I didn't expect that.Yes thankyou it is working now, I am just trying to work out why it is showing a comer at the start, the code line
Code:If strtext = " " Then strtext = rs!AgencyName Else strtext = strtext & ", " & rs!AgencyName End If
Should prevent this was my understanding however it is still happening
View attachment 83590
Hi. Does my demo show a comma at the beginning too? I didn't expect that.
Hi. I downloaded the file I posted and earlier, and I don't see a leading comma in the result.Yes both examples did
Hi DBguy I was not clear sorry the comma appears ok in the query it is when I set a field with the control source to the Module then the comma appearsHi. I downloaded the file I posted and earlier, and I don't see a leading comma in the result.
View attachment 83598
Can you post an updated copy of your db showing how you implemented my suggestion to help figure out where the extra comma is coming from? Thanks.
here is you Recommendations based on fConcat() function.