The query that is not syncing is using data from another query (qryExportToWave) and also uses VBA code within a module called SimpleCSV in Access. How do I get the query (qryExportToWaveFinal) to appear within the project? All is working correctly within Access. Here is the SQL and module code..Thanks in advance for any pointers.
SELECT DISTINCT [tblFamily.FirstName] & ' ' & [tblFamily.LastName] AS [Company Name], SimpleCSV("SELECT [First Name] From qryExportToWave WHERE [Company Name] =""" & [Company Name] & """"," & ") AS [First Name], tblStudents.LastName AS [Last Name], tblFamily.Email AS Email, tblFamily.HomePhone AS Phone, tblFamily.Add1 AS [Address 1], tblFamily.Add2 AS [Address 2], tblFamily.Town AS City, tblFamily.PostCode AS [Post Code]
FROM (tblStudents INNER JOIN tblFamily ON tblStudents.FamilyID = tblFamily.FamilyID) INNER JOIN ((tblBranches INNER JOIN tblClasses ON tblBranches.BranchID = tblClasses.BranchID) INNER JOIN tblStudentsClasses ON (tblClasses.ClassID = tblStudentsClasses.ClassID) AND (tblClasses.BranchID = tblStudentsClasses.BranchID)) ON tblStudents.StudentID = tblStudentsClasses.StudentID
WHERE (((tblStudentsClasses.ClassID) In (8,9,11,12,14,15,29,43,57,58)) AND ((tblStudents.ActiveFlag)=Yes))
ORDER BY tblStudents.LastName;
Option Compare Database
Option Explicit
Public Function SimpleCSV(strSQL As String, _
Optional strDelim As String = ",") As String
'Returns a comma delimited string of all the records in the SELECT SQL statement
'v1.0 - 8/20/2013
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strCSV As String
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
'Concatenate the first (and should be the only one) field from the SQL statement
With rs
Do While Not .EOF
strCSV = strCSV & strDelim & .Fields(0)
.MoveNext
Loop
.Close
End With
'Remove the leading delimiter and return the result
SimpleCSV = Mid$(strCSV, Len(strDelim) + 1)
Set rs = Nothing
Set db = Nothing
End Function