Queries based on Calculated Field criteria worked in Imported SQL DB but not Linked SQL DB

davidckchiu

New Member
Joined
Feb 24, 2018
Messages
2
Dear friends,

I am new to Access.

I am working to select records based on criteria using a calculated field. The criteria is the ratio of 2 fields is smaller than certain number.

When I tried it using the imported SQL DB, it works.
But when I use linked SQL DB, same DB and same calculated field and same criteria, the queries return records not based on criteria in the calculated field.

Can't figure out why ? Any hintes ?

Thanks in advance.

DC
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Welcome to the Board!

Please post the SQL code of your query, and maybe some sample data so we can see what it all looks like.
 
Last edited:
Upvote 0
Thanks.

Here is the SQL in the Aceess using imported DB file

SELECT dbo_DRUGMASTERTABLE.D_NAME, dbo_DRUGMASTERTABLE.COST, dbo_DRUGMASTERTABLE.PRICE, [PRICE]/[COST] AS Ratio
FROM dbo_DRUGMASTERTABLE
WHERE (((dbo_DRUGMASTERTABLE.COST)<>0) AND (([PRICE]/[COST])<1.3));



Here is the sample date
D_NAMECOSTPRICERatio
*DIFFLAM-C SOLUTION(500ML)1010611300001.29
,CO-PHENYLCAINE SPRAY10800126001.17
,NISITA NASAL OINT (20G)36429450001.24
,NISITA NASAL OINT (20G)36429450001.24
,RHINOCORT TH 100MCG/200DOSES2723193500001.29
.BACTROBAN 2% NASAL OINT1672722100001.26
.BACTROBAN 2% NASAL OINT1709092100001.23
.CETAPHIL CLEANSER54000700001.30
.DEMOVATE 0.05% CR. (25G)794511000001.26

<tbody>
</tbody>

Cannot have the SQL in the Linked SQL Access file, as I am not at office now.

Thanksagain
 
Upvote 0
Please confirm the Data Type of the Cost and Price fields in linked database. If one is string/text, that could be problematic.
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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