I don't believe that the DCount function will do what you want with a
parameter query, as it won't ask you for the parameters' values in order
to
run itself. I just tested a simple setup in a database here, and the
DCount
condition did not cause the macro to post a message box for me (and it
didn't ask me for the parameters)...it also didn't throw an error at me.
You'll need to use a form for the user to put the ID number and the week
number into textboxes, and then let the query read the values from the
form
instead of asking for the parameters. That way, the DCount function
should
work just fine for you.
--
Ken Snell
<MS ACCESS MVP>
Myy query is an ordinary query (select) but with 2 criteria (I put down
my
real criteria) [Enter your ID No:] with field "employeeID" and [Enter
WeekNo:] with field "Week". I want to do: when there is no record for
that
employee in that week, no message pops up and if there is/are record,
the
message will pop up to ask him to proceed the action further...
I am sorry to take up so much of your time, I was hoping it wouldn't be
that
difficult.
thanks
karen
:
is your query an "ordinary" query, that returns a set of records? or
is
it
an Action query, such as Update, Delete, Append, Make-Table?
btw, in order not to give confusion, I did mention in one of my
previous
messages using prefixed Usys for my qry, I changed that already
because
I
thought that was the cause, so my qry now is without Usys-prefix.
thanks,
Karen
:
DCount("*","Qry05userChkWkEntry") = 0
and I also tried
DCount("[TT]","Qry05userChkWkEntry") = 0
Both didn't let me go through, same error msg.
Karen
:
DCount("*", "MyQueryName") = 0
--
Ken Snell
<MS ACCESS MVP>
"Karen Yeung/Holland"
<
[email protected]>
wrote in
message
Tina, I I hope you are still there and able to read my problem
related to
what you wrote on the subject.
I am Karen and have read this subject and think this is
similar
as
what I
am
trying to do. So I tried what you wrote but I got an error
message :
Miscrosoft Access can't parse the expression: 'DCount(1,
"MyQueryName") >
0'
I also tried DCount(1, "MyQueryName")=0
My sequence of macros:
OpenQuery
MsgBox (with the above condition)
... Cancel Event
StopMacro
I used the expression for MsgBox's condition. My query is
prefixed
as
uSys... and with [paremeter criteria], I hope this is not the
problem.
I want: if the query result is zero row, the MsgBox pops up.
Now
the
problem is that it doesn't even accept my condition ?
Help please, anybody?
thanks
Karen
:
Can you help me write the condition which means, if query
result
is
empty.
it would be easier to have the condition dictate when to send
the
email,
rather than when to not send it. try adding a condition to
the
macro
action
that begins the "send email" process, as
DCount(1,"MyQueryName") > 0
if the number of records in the query is zero, then the
action
doesn't
run.
if your "send email" process is several consecutive macro
actions,
make
sure
that the subsequent actions have an ellipsis (...) in the
condition
column.
hth
Thank you for your reply.
Can you help me write the condition which means, if query
result
is
empty.
Best regards
--
Bassel
:
In macro design view click on the menu VIEW - Conditions.
Add the condition.
:
Hello
I am using a macro that runs on daily basis to send an
email
of a
certain
query results.
The query results are sometimes empty.
Is it possible to cancel sending the mail , if the
query
result is
null.
Thank you and beat regards