[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

02/20/2009 at 12:22PM PST, ID: 24163197
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

Access Concatenation of multiple Records into Single field Failing

Asked by quizzer in Access Coding/Macros, SQL Query Syntax

Tags: Access 2003

I am using a Concatenation Function I have used for years and now suddenly it does not work.
I need to get all multiple records for an Admin into one single field.
I have a query I am using to stack records prior to concatenation

SQL -
SELECT qry_30DaysExp.Functional_Admin AS Admin, "Manager - " & [Department_Manager] & Chr(13) & Chr(10) & "Contractor Name - " & [Contractor_LastName] & ", " & [Contractor_FirstName] & Chr(13) & Chr(10) & "Contractor ID - " & [Contractor_ID] & Chr(13) & Chr(10) & "Start Date - " & [Contractor_Orig_StDate] & Chr(13) & Chr(10) & "End Date - " & [Contractor_End_Date] & Chr(13) & Chr(10) & "Hourly Rate - " & Format([Onsite_Hrly_Rate],"Currency") & Chr(13) & Chr(10) & "Keyfob Provided - " & Format([Keyfob_Provided],"True/False") & Chr(13) & Chr(10) & "Keyfob Returned - " & Format([Keyfob_Returned],"True/False") & Chr(13) & Chr(10) & "Badge Provided - " & Format([Badge_Provided],"True/False") & Chr(13) & Chr(10) & "Badge Returned - " & Format([Badge_Returned],"True/False") & Chr(13) & Chr(10) & "Laptop Provided - " & Format([Laptop_Provided],"True/False") & Chr(13) & Chr(10) & "Laptop Returned - " & Format([Laptop_Returned],"True/False") AS Contractor_Exp_String
FROM qry_30DaysExp
ORDER BY qry_30DaysExp.Functional_Admin;


Results are Perfect
Manager - Doe, John
Contractor Name - Doe, Ann
Contractor ID - 370
Start Date - 8/18/2008
End Date - 2/27/2009
Hourly Rate - $85.00
Keyfob Provided - False
Keyfob Returned - False
Badge Provided - False
Badge Returned - False
Laptop Provided - False
Laptop Returned - False

However when I use the function in a query this way ContExpList_CompleteOrig: IIf([Admin] Is Not Null,GetFieldFromMultiRecords(2,[Admin],"Qry_Concatenated_Exp_Contractors_Base","Admin","Contractor_Exp_String"),"")

 (code for function in code section) it returns the following

Manager - Doe, John
Contractor Name - Doe, Ann
Contractor ID - 370
Start Date - 8/18/2008
End Date - 2/27/2009
Hourly Rate - $85.00
Keyfob Provided - False
Keyfob Returned - False
Badge Provided - False
Badge Returned - False
Laptop Provisì@üsì@L#$vL#@L#@

If I shorten the number of fields I am using to just through Badge Provided everything works fine.

I need this concatenation to fully work.  The results have to be placed on the body of an e-mail.

What can I do to fix this?  Thanks

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
Function GetFieldFromMultiRecords(pbytKeyType As Byte, pvarID As Variant, pstrTable As String, pstrIDField As String, pstrMergeField As String) As String
On Error GoTo ErrHandle_Err
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strReturnValue As String
Dim strWHERE As String
   strWHERE = " WHERE [" & pstrIDField & "]="
   Select Case pbytKeyType
       Case 1: strWHERE = strWHERE & pvarID
       Case 2: strWHERE = strWHERE & Chr(34) & pvarID & Chr(34)
       Case 3: strWHERE = strWHERE & "#" & Format(CDate(pvarID), "MM/DD/YYYY HH:NN:SS") & "#"
   End Select
   
   Set db = CurrentDb()
   
 
   Set rst = db.OpenRecordset("SELECT [" & pstrMergeField & "] FROM " & pstrTable & strWHERE)
   Do While Not rst.EOF
      strReturnValue = strReturnValue & vbCrLf & rst("[" & pstrMergeField & "]")
      'strReturnValue = strReturnValue & ", " & Chr(13) & Chr(10) & rst("[" & pstrMergeField & "]")
      rst.MoveNext
   Loop
   
   If Len(strReturnValue) > 0 Then strReturnValue = Mid(strReturnValue, 3)
   
   GetFieldFromMultiRecords = strReturnValue
ErrHandle_Exit:
    Exit Function
 
ErrHandle_Err:
    MsgBox Error$
    Resume ErrHandle_Exit
End Function
[+][-]02/20/09 12:28 PM, ID: 23695835

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/09 12:46 PM, ID: 23695991

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, SQL Query Syntax
Tags: Access 2003
Sign Up Now!
Solution Provided By: capricorn1
Participating Experts: 1
Solution Grade: A
 
 
[+][-]02/20/09 01:00 PM, ID: 23696154

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/09 01:26 PM, ID: 23696405

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/21/09 07:08 AM, ID: 23700193

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/21/09 07:45 AM, ID: 23700374

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/21/09 08:09 AM, ID: 23700457

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/23/09 04:53 AM, ID: 23710546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/23/09 05:55 AM, ID: 23711084

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_3_20080625