xdanxbrash
New Member
- Joined
- Mar 7, 2019
- Messages
- 6
Hi and thank you for considering my problem...
I am receiving from Access an error message....data type mismatch in criteria expression
The crazy thing is that I have run this before and not had a problem. I am trying to make a make table query for a union situation. I have three queries I am using to do this.
SELECT * INTO MakeTableQuerySalesReturnUnion
FROM (SELECT * FROM [Returnx] UNION SELECT * FROM [Salesx]) AS [%$##@_Alias];
...is my main query to achieve the make table...and the following two queries are the Returnx and Salesx queries...
This is the Salesx query...
SELECT sales.sal_pr AS [Net Sales], articles.wp AS Cost, articles.rp, employee.num_em, employee.nam_em, sales.sal_dt, CDbl([models].[modeldis]) AS Margin, stores.st_num, stores.st_nam, models.modelc, models.model, [Macys Calendar 2010 - 2020].Ret_Week_No, [Macys Calendar 2010 - 2020].Ret_Mo, [Macys Calendar 2010 - 2020].Ret_Mo_Wk, articles.article, articles.descr
FROM ((((sales INNER JOIN stores ON sales.sal_snum = stores.st_num) INNER JOIN articles ON sales.sal_art = articles.article) INNER
JOIN models ON articles.model_c = models.modelc) INNER JOIN [Macys Calendar 2010 - 2020] ON sales.sal_dt = [Macys Calendar 2010 - 2020].Cal_Dt) INNER JOIN employee ON sales.sal_emp = employee.num_em
WHERE (((sales.sal_dt) Between #2/3/2019# And #3/2/2019#));
.....and this is the Returnx query...
SELECT (-[credit].[pr_cr]) AS [Net Sales], (-[articles].[wp]) AS Cost, articles.rp, employee.num_em, employee.nam_em, credit.ym_cr, CDbl([models].[modeldis]) AS Margin, stores.st_num, stores.st_nam, models.modelc, models.model, [Macys Calendar 2010 - 2020].Ret_Week_No, [Macys Calendar 2010 - 2020].Ret_Mo, [Macys Calendar 2010 - 2020].Ret_Mo_Wk, articles.article, articles.descr
FROM ((((credit INNER JOIN stores ON credit.stc_cr = stores.st_num) INNER JOIN articles ON credit.art_cr = articles.article) INNER JOIN models ON articles.model_c = models.modelc) INNER JOIN [Macys Calendar 2010 - 2020] ON credit.ym_cr = [Macys Calendar 2010 - 2020].Cal_Dt) INNER JOIN employee ON credit.emp_cr = employee.num_em
WHERE (((credit.ym_cr) Between #2/3/2019# And #3/2/2019#));
I only have the one date criteria in both...and the crazy thing is that each individual select query (Salesx and Returnx) run fine when not run out of the main union make table query shown at the top...
What do you think I've done wrong?
Thanks,
Dan
I am receiving from Access an error message....data type mismatch in criteria expression
The crazy thing is that I have run this before and not had a problem. I am trying to make a make table query for a union situation. I have three queries I am using to do this.
SELECT * INTO MakeTableQuerySalesReturnUnion
FROM (SELECT * FROM [Returnx] UNION SELECT * FROM [Salesx]) AS [%$##@_Alias];
...is my main query to achieve the make table...and the following two queries are the Returnx and Salesx queries...
This is the Salesx query...
SELECT sales.sal_pr AS [Net Sales], articles.wp AS Cost, articles.rp, employee.num_em, employee.nam_em, sales.sal_dt, CDbl([models].[modeldis]) AS Margin, stores.st_num, stores.st_nam, models.modelc, models.model, [Macys Calendar 2010 - 2020].Ret_Week_No, [Macys Calendar 2010 - 2020].Ret_Mo, [Macys Calendar 2010 - 2020].Ret_Mo_Wk, articles.article, articles.descr
FROM ((((sales INNER JOIN stores ON sales.sal_snum = stores.st_num) INNER JOIN articles ON sales.sal_art = articles.article) INNER
JOIN models ON articles.model_c = models.modelc) INNER JOIN [Macys Calendar 2010 - 2020] ON sales.sal_dt = [Macys Calendar 2010 - 2020].Cal_Dt) INNER JOIN employee ON sales.sal_emp = employee.num_em
WHERE (((sales.sal_dt) Between #2/3/2019# And #3/2/2019#));
.....and this is the Returnx query...
SELECT (-[credit].[pr_cr]) AS [Net Sales], (-[articles].[wp]) AS Cost, articles.rp, employee.num_em, employee.nam_em, credit.ym_cr, CDbl([models].[modeldis]) AS Margin, stores.st_num, stores.st_nam, models.modelc, models.model, [Macys Calendar 2010 - 2020].Ret_Week_No, [Macys Calendar 2010 - 2020].Ret_Mo, [Macys Calendar 2010 - 2020].Ret_Mo_Wk, articles.article, articles.descr
FROM ((((credit INNER JOIN stores ON credit.stc_cr = stores.st_num) INNER JOIN articles ON credit.art_cr = articles.article) INNER JOIN models ON articles.model_c = models.modelc) INNER JOIN [Macys Calendar 2010 - 2020] ON credit.ym_cr = [Macys Calendar 2010 - 2020].Cal_Dt) INNER JOIN employee ON credit.emp_cr = employee.num_em
WHERE (((credit.ym_cr) Between #2/3/2019# And #3/2/2019#));
I only have the one date criteria in both...and the crazy thing is that each individual select query (Salesx and Returnx) run fine when not run out of the main union make table query shown at the top...
What do you think I've done wrong?
Thanks,
Dan