txgeekgirl
Registered User.
- Local time
- Today, 13:07
- Joined
- Jul 31, 2008
- Messages
- 187
I am trying to reference a Form Control for an IN() Criteria in a Query.
In the VBA - I wrapped txt quotes around the items in the list and saved to a form control tb.Filter - seperated by no space comma - trimming last comma.
In the Query - I need it to append only items where StaffID IN List... not recognizing any criteria and appends zero items. Any hints??? :banghead:
In the VBA - I wrapped txt quotes around the items in the list and saved to a form control tb.Filter - seperated by no space comma - trimming last comma.
Code:
strFilter = ""
'get all StaffIDS
For Each var In Me.lbStaff.ItemsSelected
strFilter = strFilter & "'" & Me.lbStaff.Column(0, var) & "',"
Next var
Me.tbFilter = Mid(strFilter, 1, Len(strFilter) - 1)
In the Query - I need it to append only items where StaffID IN List... not recognizing any criteria and appends zero items. Any hints??? :banghead:
Code:
INSERT INTO GetSumTbl ( LineItem, LineDesc, PayCode, Quantity )
SELECT EmpQ.StaffId, EmpQ.EmpName, [Pay Codes].PayCode, 0 AS MyQuantity
FROM EmpQ, [Pay Codes]
WHERE (((EmpQ.StaffId) In ([Forms]![Accounting Report]![tbFilter])))
ORDER BY EmpQ.StaffId;