Hi,
Should not. In the immediate (debug) window:
=====================================================
CurrentDb.Execute "CREATE TABLE testing (f1 varchar(50)) "
CurrentDb.Execute "INSERT INTO testing(f1) VALUES('AaAa') "
CurrentDb.Execute "INSERT INTO testing(f1) VALUES('AAAA') "
? CurrentDb.OpenRecordset("SELECT COUNT(*) FROM testing WHERE
f1='aaaa'").Fields(0).Value
2
======================================================
we got f1='aaaa' with two matches, while a binary comparison would have
supplied 0.
Same thing if I use a module:
=======================================================
Option Compare Binary '<<<<<<<<<<
Option Explicit
Public Sub TestingItInAModule()
Debug.Print CurrentDb.OpenRecordset("SELECT COUNT(*) FROM testing WHERE
f1='aaaa'").Fields(0).Value
End Sub
=========================================================
a 2 is returned in the immediate window.
Vanderghast, Access MVP
0=StrComp( table1.Field1, table2.field2, 0 ) works fine for the table to
table comparison but why does my Query B which uses
((ppbenf.ppcode_benf)="E1CA") work as a binary compare? hmmmm...
Michel Walsh wrote:
Hi,
You must not use
table1.field1 = table2.field2
but
0=StrComp( table1.Field1, table2.field2, 0 )
to binary compare strings stored in table(s), or
0=StrComp( table1.Field1, "aAaC", 0)
for binary comparison between a string in a table with a constant
string.
Hoping it may help,
Vanderghast, Access MVP
Actually, no that doesn't help a lot. Maybe I misstated the real
problem. Here is a further definition of the problem:
When I run Query A it:
1) runs forever (hours) and table tbl_detail_Bene only has 2000 records.
Its like the query thinks its running against a non keyed table and it
is not.
2) and more importantly, it gets equal compare on codes "E1CA" and
"E1cA" whereas Query B doesn't. I have verified that tbl_detail_Bene
only contains "E1CA"
I need to resolve both issues but item 2 is more important
==========================
Query A gets the benefit code description (ppbenf.ppdesc_benf) from
ppbenf table. The source table (tbl_detail_Bene) fields INNER JOIN to
all ppbenf table's key fields.
Table tbl_detail_Bene is not keyed. Table ppbenf is.
===============================
Query A:
SELECT tbl_detail_Bene.ppbenB, tbl_detail_Bene.chplan,
tbl_detail_Bene.chplrv, tbl_detail_Bene.[CLL-BENEFIT-CD],
ppbenf.ppcode_benf, tbl_detail_Bene.cdbnsf, ppbenf.ppdesc_benf INTO
tbl_Detail_bene_desc
FROM tbl_detail_Bene INNER JOIN ppbenf ON (tbl_detail_Bene.cdbnsf =
ppbenf.ppsufx_benf) AND (tbl_detail_Bene.[CLL-BENEFIT-CD] =
ppbenf.ppcode_benf) AND (tbl_detail_Bene.chplrv = ppbenf.pprevl_benf)
AND (tbl_detail_Bene.chplan = ppbenf.ppplno_benf) AND
(tbl_detail_Bene.ppbenB = ppbenf.ppcnst_benf);
==================================
Query B:
SELECT ppbenf.ppcnst_benf, ppbenf.ppplno_benf, ppbenf.pprevl_benf,
ppbenf.ppcode_benf, ppbenf.ppsufx_benf, ppbenf.ppdesc_benf
FROM ppbenf
WHERE (((ppbenf.ppcnst_benf)="b") AND ((ppbenf.ppplno_benf)="97181A")
AND ((ppbenf.pprevl_benf)="02") AND ((ppbenf.ppcode_benf)="E1CA") AND
((ppbenf.ppsufx_benf)="C"));