D
Daniel
Hello
I have the following code and I keep getting an error about my WHERE
statement about a missing operator... but I can't seem to see my mistake for
the life of me. Could someone please point it out to me.
************
Dim vItm As Variant
Dim stWhat As String
Dim stCriteria As String
Dim stSQL As String
Dim Criteria As String
Dim loqd As QueryDef
stWhat = "": stCriteria = ","
For Each vItm In Me![Work Packages List].ItemsSelected
stWhat = stWhat & Me![Work Packages List].ItemData(vItm)
stWhat = stWhat & stCriteria
Next vItm
Criteria = (CStr(Left$(stWhat, Len(stWhat) - Len(stCriteria))))
Set loqd = CurrentDb.QueryDefs("DRM Report Qry 04")
stSQL = "SELECT [DRM Report Qry 03 (CDI Commit Date)].[Work Package],
[DRM Report Qry 03 (CDI Commit Date)].[Associated Project], [DRM Report Qry
03 (CDI Commit Date)].[Drawing History Id], [DRM Report Qry 03 (CDI Commit
Date)].[Drawing Number], [DRM Report Qry 03 (CDI Commit Date)].[Drawing
Issue], [DRM Report Qry 03 (CDI Commit Date)].[Drawing Title], [DRM Report
Qry 03 (CDI Commit Date)].[CDI Commit Date], [DRM Report Qry 03 (CDI Commit
Date)].[Request for Review], [DRM Information Tbl].[DRM Drawing Priority],
[DRM Information Tbl].[DRM Drawing Status], [DRM Information Tbl].[DMR Gilda
Status], [DRM Information Tbl].[DRM Comments]" & _
" FROM [DRM Report Qry 03 (CDI Commit Date)] LEFT JOIN
[DRM Information Tbl] ON [DRM Report Qry 03 (CDI Commit Date)].[Drawing
History Id] = [DRM Information Tbl].[Drawing History Id]" & _
" WHERE ([DRM Report Qry 03 (CDI Commit Date)].[Work
Package] IN (" & Criteria & "))" & _
" ORDER BY [DRM Report Qry 03 (CDI Commit Date)].[Work
Package], [DRM Report Qry 03 (CDI Commit Date)].[Associated Project], [DRM
Report Qry 03 (CDI Commit Date)].[Drawing Number], [DRM Report Qry 03 (CDI
Commit Date)].[Drawing Issue];"
loqd.SQL = stSQL
loqd.Close
**************
Thanks
Daniel
I have the following code and I keep getting an error about my WHERE
statement about a missing operator... but I can't seem to see my mistake for
the life of me. Could someone please point it out to me.
************
Dim vItm As Variant
Dim stWhat As String
Dim stCriteria As String
Dim stSQL As String
Dim Criteria As String
Dim loqd As QueryDef
stWhat = "": stCriteria = ","
For Each vItm In Me![Work Packages List].ItemsSelected
stWhat = stWhat & Me![Work Packages List].ItemData(vItm)
stWhat = stWhat & stCriteria
Next vItm
Criteria = (CStr(Left$(stWhat, Len(stWhat) - Len(stCriteria))))
Set loqd = CurrentDb.QueryDefs("DRM Report Qry 04")
stSQL = "SELECT [DRM Report Qry 03 (CDI Commit Date)].[Work Package],
[DRM Report Qry 03 (CDI Commit Date)].[Associated Project], [DRM Report Qry
03 (CDI Commit Date)].[Drawing History Id], [DRM Report Qry 03 (CDI Commit
Date)].[Drawing Number], [DRM Report Qry 03 (CDI Commit Date)].[Drawing
Issue], [DRM Report Qry 03 (CDI Commit Date)].[Drawing Title], [DRM Report
Qry 03 (CDI Commit Date)].[CDI Commit Date], [DRM Report Qry 03 (CDI Commit
Date)].[Request for Review], [DRM Information Tbl].[DRM Drawing Priority],
[DRM Information Tbl].[DRM Drawing Status], [DRM Information Tbl].[DMR Gilda
Status], [DRM Information Tbl].[DRM Comments]" & _
" FROM [DRM Report Qry 03 (CDI Commit Date)] LEFT JOIN
[DRM Information Tbl] ON [DRM Report Qry 03 (CDI Commit Date)].[Drawing
History Id] = [DRM Information Tbl].[Drawing History Id]" & _
" WHERE ([DRM Report Qry 03 (CDI Commit Date)].[Work
Package] IN (" & Criteria & "))" & _
" ORDER BY [DRM Report Qry 03 (CDI Commit Date)].[Work
Package], [DRM Report Qry 03 (CDI Commit Date)].[Associated Project], [DRM
Report Qry 03 (CDI Commit Date)].[Drawing Number], [DRM Report Qry 03 (CDI
Commit Date)].[Drawing Issue];"
loqd.SQL = stSQL
loqd.Close
**************
Thanks
Daniel