Macro Mystery???


G

Guest

I'm using

DCount("*","Match For TM and Incremental")>0

in the conditional column to close my query if the results are 0 records.
THere are many queries (37) that run in the macro to check for possible
matching records between tables. I only want the ones with results of matches
to open. Each of the 37 queries have the above conditon in the condition
column.

I have found that even queries with records in the result are NOT opening?
Can anybody help???
Adam
 
Ad

Advertisements

K

Ken Snell [MVP]

You'll need to post more details about the macro's entire contents. Show all
steps in the macro, including Conditions, Actions, etc.
 
G

Guest

Below I listed the details of the macro design window...
Condition
DCount("*","Match For 50-64 Adv & 50-64 DM")>0

Action
OpenQuery

Comment
None

Query Name: Match For 50-64 Adv & 50-64 DM
View: Datasheet
Data Mode: Edit
 
K

Ken Snell [MVP]

This macro step will not close an already open query. It only opens the
query if the query contains at least one record. Once opened, the query will
remain open until you close it manually.
 
G

Guest

Sorry Ken I wronly stated my comment at the start...

That's what i want, to open only if there are more than 0 records..and i
have results that are more than zero (for example in one query the result i
have 2 records) and it still doesn't open.
 
K

Ken Snell [MVP]

OK -

Let's start by ensuring that you have spelled the name of the query
correctly in the DCount function. If it is correct, then try this:
DCount("*","[Match For 50-64 Adv & 50-64 DM]")>0

If this still doesn't work, post back and we'll do some more digging into
the workings here.

--

Ken Snell
<MS ACCESS MVP>
 
Ad

Advertisements

G

Guest

I checked all the names and the queries run fine once i remove the
conditional statement. All queries show when they have records or not. Once i
put the conditional statement back in - those that have records don't open
along with those that dont have any records (which is the goal).

I changed the conditional statement i had for the one you provided and i
specifically used it with a query i know has results - after i saved the
macro and ran it with the new statement it still did not show the records for
the query.

-Adam

Ken Snell said:
OK -

Let's start by ensuring that you have spelled the name of the query
correctly in the DCount function. If it is correct, then try this:
DCount("*","[Match For 50-64 Adv & 50-64 DM]")>0

If this still doesn't work, post back and we'll do some more digging into
the workings here.

--

Ken Snell
<MS ACCESS MVP>


Adam said:
Sorry Ken I wronly stated my comment at the start...

That's what i want, to open only if there are more than 0 records..and i
have results that are more than zero (for example in one query the result
i
have 2 records) and it still doesn't open.
 
Ad

Advertisements

K

Ken Snell [MVP]

So, what that suggests to me is that the query "Match For 50-64 Adv & 50-64
DM" may have a criterion expression in it that, at the time you run the
macro, means that the query isn't returning any records.

Post the SQL statement of the "Match For 50-64 Adv & 50-64 DM" query.

--

Ken Snell
<MS ACCESS MVP>

Adam said:
I checked all the names and the queries run fine once i remove the
conditional statement. All queries show when they have records or not.
Once i
put the conditional statement back in - those that have records don't open
along with those that dont have any records (which is the goal).

I changed the conditional statement i had for the one you provided and i
specifically used it with a query i know has results - after i saved the
macro and ran it with the new statement it still did not show the records
for
the query.

-Adam

Ken Snell said:
OK -

Let's start by ensuring that you have spelled the name of the query
correctly in the DCount function. If it is correct, then try this:
DCount("*","[Match For 50-64 Adv & 50-64 DM]")>0

If this still doesn't work, post back and we'll do some more digging into
the workings here.

--

Ken Snell
<MS ACCESS MVP>


Adam said:
Sorry Ken I wronly stated my comment at the start...

That's what i want, to open only if there are more than 0 records..and
i
have results that are more than zero (for example in one query the
result
i
have 2 records) and it still doesn't open.

:

This macro step will not close an already open query. It only opens
the
query if the query contains at least one record. Once opened, the
query
will
remain open until you close it manually.

--

Ken Snell
<MS ACCESS MVP>

Below I listed the details of the macro design window...
Condition
DCount("*","Match For 50-64 Adv & 50-64 DM")>0

Action
OpenQuery

Comment
None

Query Name: Match For 50-64 Adv & 50-64 DM
View: Datasheet
Data Mode: Edit

:

You'll need to post more details about the macro's entire contents.
Show
all
steps in the macro, including Conditions, Actions, etc.

--

Ken Snell
<MS ACCESS MVP>

I'm using

DCount("*","Match For TM and Incremental")>0

in the conditional column to close my query if the results are 0
records.
THere are many queries (37) that run in the macro to check for
possible
matching records between tables. I only want the ones with
results
of
matches
to open. Each of the 37 queries have the above conditon in the
condition
column.

I have found that even queries with records in the result are NOT
opening?
Can anybody help???
Adam
 

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

Similar Threads


Top