Hello,
The query now works, but it brings back all data, and doesn't seem to specify the filtering based on the dates. Below is the query the listbox is bound to:
Code:
SELECT Tbl_SMT.FullName AS [SMT Tech Name], TblQuality.Date, TblQuality.TelScore AS [Telephone Score], TblQuality.SAPNotNoCompleted AS [Notifications Raised], TblQuality.SAPNotTelephone AS [(T) Telephone], TblQuality.SAPNotEmail AS [(E) Email], TblQuality.SAPNotFace AS [(F) Face to Face], TblQuality.SAPNotProcess AS [(P) Process], TblQuality.SAPNotWorkType AS [Incorrect Work Type], TblQuality.SAPNotLongText AS [Long Text Missing], TblQuality.SAPNotReportedBy AS [Reported By Missing], TblQuality.SAPNotPrioritySet AS [Incorrect Priority], TblQuality.SAPNotConstraintDates AS [Constraint Dates], TblQuality.SAPNotREVariance AS [RE Variance], TblQuality.SAPConNumberComp AS [Confirmations Made], TblQuality.SAPConNoEmployeeNo AS [Employee ID Missing], TblQuality.SAPConNoConfText AS [No Confirmation Text], TblQuality.SAPConZeroMins AS [Zero Minutes], TblQuality.SMQRej1 AS Rejects FROM (TblQuality LEFT JOIN Tbl_SMT ON TblQuality.Username=Tbl_SMT.Username) LEFT JOIN Tbl_TLs ON Tbl_SMT.TeamLeaderID=Tbl_TLs.Username WHERE (((Tbl_SMT.FullName) Like Forms!frmShow!Combo1.value) And ((forms!frmShow!text30.value)) And ((Tbl_TLs.FullName) Like forms!frmShow!combo5.value));
The VBA which my code outputs into text30.value is:
Code:
ListBox1.AddItem "01/" & Combo3.Value & "/" & Combo29.Value
Dim strstring As String
strstring = ""
For i = 0 To Me.ListBox1.ListCount - 1
If i = Me.ListBox1.ListCount - 1 Then
strstring = strstring & "((tblQuality.Date)=#" & Format(Me.ListBox1.Column(0, i), "DD/MM/YYYY") & "#)"
Else
strstring = strstring & "((tblQuality.Date)=#" & Format(Me.ListBox1.Column(0, i), "DD/MM/YYYY") & "#) Or "
End If
Next i
Text30.Value = strstring
List7.Requery
Can anyone shed any light on this?