Evaluating the results of a querie

C

Chris Gorham

Hi,

I'm trying to write some code such that I can check that only the expected
data is in a field of an imported table.

Tried this:
querie_result = DCount("*", "Test Import New Circuit?")
If querie_result = 0 Or querie_result > 2 Then i = 0: GoTo jump4
If DCount("[Circuit?]", "Test Import New Circuit?", "[Circuit?]" =
"Circuit") = 1 Then querie_result = querie_result - 1
If DCount("[Circuit?]", "Test Import New Circuit?", "[Circuit?]" = "Non
Circuit") = 1 Then querie_result = querie_result - 1
If querie_result <> 0 Then GoTo jump4

where "Test Import New Circuit?" is a simple querie that should return just
2 results: "Circuit" and/or "Non Circuit" from a field of the imported table
called "Circuit?".
I then test for the presence of each of these in the querie results.
I'm sure that this is an inefficient way of going about things and anyway I
can't get the DCount("[Circuit?]", "Test Import New Circuit?", "[Circuit?]" =
"Non Circuit") = 1 to work...

Suggestions welcome...Chris
 
A

Alex Dybenko

Hi,
If Circuit field has only 2 values - Circuit and Non Circuit - then you
don't need to run third DCount, as you can save values, returned by first
two and subtract second from the first
You can also make a union query which will return all three counts at once,
but not sure you much gain here

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top