mrmmickle1
Well-known Member
- Joined
- May 11, 2012
- Messages
- 2,461
I'm getting an error on this line of code:
Not sure what's happening.
Here is the sql:
When I use the immediate window the values are what I expect. I have also confirmed that they are indeed defined as a date:
1/1/2015 and 12/31/2015
Can someone please help me identify how to correct this issue?
Code:
[COLOR=#0000ff][B]Set [/B][/COLOR]qdf = db.QueryDefs("05 YTD Terms")
qdf.Parameters("[forms]![frm001-Export]![DateEntry]") = [Forms]![frm001-Export]![DateEntry]
qdf.Parameters("[forms]![frm001-Export]![YTDBegin]") = [Forms]![frm001-Export]![YTDBegin]
[B][COLOR=#ff0000] Set rst = qdf.OpenRecordset[/COLOR][/B]
Not sure what's happening.
Here is the sql:
Code:
SELECT [Termination Date]+1 AS [Term Effective Date], [tbl007-YTD Terms].[Employee Name], [tbl007-YTD Terms].[Employee Number], [tbl007-YTD Terms].[Job Function Description], [tbl007-YTD Terms].[Job Sub Function Desc], [tbl007-YTD Terms].[Employee Organization LOB], [tbl007-YTD Terms].[Employee Organization SubLOB], [tbl007-YTD Terms].[Employee Organization Department], [tbl007-YTD Terms].[Employee Organization Level E], [tbl007-YTD Terms].[Employee Organization Level F], [tbl007-YTD Terms].[Employee Organization Level G], [tbl007-YTD Terms].[Employee Organization Level H], [tbl007-YTD Terms].[Employee Organization LOB Code], [tbl007-YTD Terms].[Employee Organization SubLOB Code], [tbl007-YTD Terms].[Employee Organization Department Code], [tbl007-YTD Terms].[Employee Organization Level E Code], [tbl007-YTD Terms].[Local Pay Grade (Actual)] AS [Local Grade], [reftbl001-Grade Grouping].Group AS [Grade Equivalent], [tbl007-YTD Terms].[Employee Location Name], [tbl007-YTD Terms].[Employee Ethnic Group Description], [tbl007-YTD Terms].[Employee Gender Description], [tbl007-YTD Terms].[Sales Indicator], [tbl007-YTD Terms].[Event Group Description], [tbl007-YTD Terms].[Event Sub Group Description], [tbl007-YTD Terms].[Source Event Type Description], [tbl007-YTD Terms].[Source Event Reason Description], [tbl007-YTD Terms].[Performance Rating], [tbl007-YTD Terms].[Adjusted Service Date], [tbl007-YTD Terms].[Total Annual Base Salary], [tbl007-YTD Terms].[Employee Location Country Name], [tbl007-YTD Terms].Region, [tbl007-YTD Terms].[Sub Region]
FROM [tbl007-YTD Terms] LEFT JOIN [reftbl001-Grade Grouping] ON [tbl007-YTD Terms].[Local Pay Grade] = [reftbl001-Grade Grouping].Grade
WHERE ((([tbl007-YTD Terms].[Termination Date]) Between [COLOR=#ff0000][B][forms]![frm001-Export]![YTDBegin]-1[/B][/COLOR] And [B][COLOR=#ff0000][forms]![frm001-Export]![DateEntry]-1[/COLOR][/B]))
ORDER BY [Termination Date]+1 DESC , [tbl007-YTD Terms].[Employee Name];
When I use the immediate window the values are what I expect. I have also confirmed that they are indeed defined as a date:
1/1/2015 and 12/31/2015
Can someone please help me identify how to correct this issue?
Last edited: