Hi Douglas - I am still getting a expression type mismatch from the
following
query:
PARAMETERS [Forms]![Main Menu]![Store] Text ( 255 ), [Forms]![Main
Menu]![Year] Short, [Forms]![Main Menu]![Week] Short;
SELECT VALIDDATABODY.storeNumber, [RSM STORE LISTING].[Store Name],
VALIDDATABODY.week, VALIDDATABODY.year,
[BaseMargin(£)]/[BaseValueAmountExcVAT] AS [BaseMargin(%)],
(([Extd_REV]-[Extd_WCEV])/[Extd_REV]) AS [Input Margin], [RSM STORE
LISTING].RSM
FROM [RSM STORE LISTING] INNER JOIN (dbo_Despatch_data_branch_summary
INNER
JOIN VALIDDATABODY ON (VALIDDATABODY.storeNumber =
CLng(dbo_Despatch_data_branch_summary.Branch))
AND (CLng(dbo_Despatch_data_branch_summary.Dept) =
VALIDDATABODY.MSRDepartment)) ON [RSM STORE LISTING].Store =
VALIDDATABODY.storeNumber
WHERE (((VALIDDATABODY.Year)=2009) AND
((dbo_Despatch_data_branch_summary.Year)='2008' Or
(dbo_Despatch_data_branch_summary.Year)='2009'))
GROUP BY VALIDDATABODY.storeNumber, [RSM STORE LISTING].[Store Name],
VALIDDATABODY.week, VALIDDATABODY.year, [RSM STORE LISTING].RSM,
dbo_Despatch_data_branch_summary.Branch,
dbo_Despatch_data_branch_summary.Extd_WCEV,
dbo_Despatch_data_branch_summary.Extd_REV;
Do you know what I've done wrong? Thanks
Douglas J. Steele said:
Create your query as normal, then go into the SQL view and change
ON Table1.NumericField = Table2.TextField
to
ON CStr(Table1.NumericField) = Table2.TextField
or
ON Table1.NumericField = CLng(Table2.TextField)
Note that once you make that change, you will not be able to go back to
Design view in your query.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Hey guys
Have you ever had a scenario where you are trying to join fields of
different datatypes? I have 2 tables where I need to join on store and
department and in both tables they are different datatypes (text in
one,
number in the other).
Other than changing the datatypes in the underlying tables, any ideas
what
can be done?
Thanks.