Data Mismatch type

megsy92

New Member
Joined
Sep 2, 2015
Messages
26
Hi Guys someone made an Access database before i arrived and has now left, it was working before but now i get "Data mismatch type" and i have NO idea why it has stopped working. Could someone please help me the SQL is below.


SELECT Val([RAW_AR_Data_Table]![Account]) AS Account, IIf([RAW_AR_Data_Table]![Assignment]="",Val([RAW_AR_Data_Table]![Document Number]),IIf(Len([RAW_AR_Data_Table]![Assignment])<10,Val(0),Val([RAW_AR_Data_Table]![Document Number]))) AS [Invoice Document Number], RAW_AR_Data_Table.[Document currency], RAW_AR_Data_Table.[Amount in doc curr], RAW_AR_Data_Table.[Local Currency], RAW_AR_Data_Table.[Amount in local currency], RAW_AR_Data_Table.Text, RAW_AR_Data_Table.[Net due date], RAW_AR_Data_Table.[Document Date], IIf([RAW_AR_Data_Table]![Net due date]>Now(),0,DateValue(Now())-([RAW_AR_Data_Table]![Net due date])) AS [Age Uncleared] INTO RAW_AR_Data_Reformat_Table
FROM RAW_AR_Data_Table
WHERE (((IIf([RAW_AR_Data_Table]![Assignment]="",Val([RAW_AR_Data_Table]![Document Number]),IIf(Len([RAW_AR_Data_Table]![Assignment])<10,Val(0),Val([RAW_AR_Data_Table]![Document Number]))))>0) AND ((RAW_AR_Data_Table.[Document Type]) Like "RV"));
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Check the Account, Document Number and Net Due Date fields. When using VAL a Data Type Mismatch error is returned if the field is NULL (don't think it does if it's text rather than a number - just returns 0).
If the query was working previously it's more likely to be some rubbish in the data.
 
Upvote 0

Forum statistics

Threads
1,214,399
Messages
6,119,279
Members
448,884
Latest member
chuffman431a

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top