Dear Crystal,
Thanks a lot for your help. The problem is solved, I received your message right after my reply to Duane, Here's my solution:
I found out that the query is correct, it just that the unbound text box didn't pass the value to the query. I add a requery on the form load event to pass the value. It works perfect now. Thanks again.
Best Regards,
Kevin
--------------------------------------------
On Sun, 1/20/19, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
Subject: Re: [MS_AccessPros] DatePart Criteria doesn't work.
To: MS_Access_Professionals@yahoogroups.com
Date: Sunday, January 20, 2019, 2:54 PM
hi Kevin,
another thing you can try is setting the data type to be
Integer for
[Forms]![frmOfficeLocationProfit]![MonthCalc]
in the query Parameters
or perhaps surround NZ with CInt to convert to
integer
~crystal
On 1/19/2019
11:14 PM, Duane Hookom
duanehookom@hotmail.com
[MS_Access_Professionals] wrote:
Kevin,
What happens if you open the debug window (press
Ctrl+G) and
enter:
?
DSum("AmountFinal","qryManagerialCostCalc","ActualMonth=1")
What is the SQL view of
qryManagerialCostCalc?
What do you see if you create a new blank
query and enter this SQL:
SELECT Sum(AmountFinal) as TotalFinalIn
FROM qry ManagerialCostCalc WHERE ActualMonth =
1;
Regards,
Duane
From:�
Qingqing qingqinga@yahoo.com
Sent:
Saturday, January 19, 2019 11:02 PM
�
Dear All,
I tried to use DatePart('m',MyDate)
to get the month,in
a query, it worked fine. But when I apply
the month as
criteria in a form, it didn't work.
after running the
query, the result is bland, containing no
record. Here's
what I have in a form query:
TotalFinalIn:
DSum("AmountFinal","qryManagerialCostCalc","ActualMonth="
&
Nz([Forms]![frmOfficeLocationProfit]![MonthCalc],0))
The MonthCalc in the form is unbound text
box. and on
the form load event I use:
Me.MonthCalc=Month(Date), I
want to calculate the total managerial cost
in the
current month.
Please help.
Best Regards,
Kevin
#yiv9794198488 #yiv9794198488 --
#yiv9794198488ygrp-mkp {
border:1px solid #d8d8d8;font-family:Arial;margin:10px
0;padding:0 10px;}
#yiv9794198488 #yiv9794198488ygrp-mkp hr {
border:1px solid #d8d8d8;}
#yiv9794198488 #yiv9794198488ygrp-mkp #yiv9794198488hd {
color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}
#yiv9794198488 #yiv9794198488ygrp-mkp #yiv9794198488ads {
margin-bottom:10px;}
#yiv9794198488 #yiv9794198488ygrp-mkp .yiv9794198488ad {
padding:0 0;}
#yiv9794198488 #yiv9794198488ygrp-mkp .yiv9794198488ad p {
margin:0;}
#yiv9794198488 #yiv9794198488ygrp-mkp .yiv9794198488ad a {
color:#0000ff;text-decoration:none;}
#yiv9794198488 #yiv9794198488ygrp-sponsor
#yiv9794198488ygrp-lc {
font-family:Arial;}
#yiv9794198488 #yiv9794198488ygrp-sponsor
#yiv9794198488ygrp-lc #yiv9794198488hd {
margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}
#yiv9794198488 #yiv9794198488ygrp-sponsor
#yiv9794198488ygrp-lc .yiv9794198488ad {
margin-bottom:10px;padding:0 0;}
#yiv9794198488 #yiv9794198488actions {
font-family:Verdana;font-size:11px;padding:10px 0;}
#yiv9794198488 #yiv9794198488activity {
background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}
#yiv9794198488 #yiv9794198488activity span {
font-weight:700;}
#yiv9794198488 #yiv9794198488activity span:first-child {
text-transform:uppercase;}
#yiv9794198488 #yiv9794198488activity span a {
color:#5085b6;text-decoration:none;}
#yiv9794198488 #yiv9794198488activity span span {
color:#ff7900;}
#yiv9794198488 #yiv9794198488activity span
.yiv9794198488underline {
text-decoration:underline;}
#yiv9794198488 .yiv9794198488attach {
clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}
#yiv9794198488 .yiv9794198488attach div a {
text-decoration:none;}
#yiv9794198488 .yiv9794198488attach img {
border:none;padding-right:5px;}
#yiv9794198488 .yiv9794198488attach label {
display:block;margin-bottom:5px;}
#yiv9794198488 .yiv9794198488attach label a {
text-decoration:none;}
#yiv9794198488 blockquote {
margin:0 0 0 4px;}
#yiv9794198488 .yiv9794198488bold {
font-family:Arial;font-size:13px;font-weight:700;}
#yiv9794198488 .yiv9794198488bold a {
text-decoration:none;}
#yiv9794198488 dd.yiv9794198488last p a {
font-family:Verdana;font-weight:700;}
#yiv9794198488 dd.yiv9794198488last p span {
margin-right:10px;font-family:Verdana;font-weight:700;}
#yiv9794198488 dd.yiv9794198488last p
span.yiv9794198488yshortcuts {
margin-right:0;}
#yiv9794198488 div.yiv9794198488attach-table div div a {
text-decoration:none;}
#yiv9794198488 div.yiv9794198488attach-table {
width:400px;}
#yiv9794198488 div.yiv9794198488file-title a, #yiv9794198488
div.yiv9794198488file-title a:active, #yiv9794198488
div.yiv9794198488file-title a:hover, #yiv9794198488
div.yiv9794198488file-title a:visited {
text-decoration:none;}
#yiv9794198488 div.yiv9794198488photo-title a,
#yiv9794198488 div.yiv9794198488photo-title a:active,
#yiv9794198488 div.yiv9794198488photo-title a:hover,
#yiv9794198488 div.yiv9794198488photo-title a:visited {
text-decoration:none;}
#yiv9794198488 div#yiv9794198488ygrp-mlmsg
#yiv9794198488ygrp-msg p a span.yiv9794198488yshortcuts {
font-family:Verdana;font-size:10px;font-weight:normal;}
#yiv9794198488 .yiv9794198488green {
color:#628c2a;}
#yiv9794198488 .yiv9794198488MsoNormal {
margin:0 0 0 0;}
#yiv9794198488 o {
font-size:0;}
#yiv9794198488 #yiv9794198488photos div {
float:left;width:72px;}
#yiv9794198488 #yiv9794198488photos div div {
border:1px solid
#666666;min-height:62px;overflow:hidden;width:62px;}
#yiv9794198488 #yiv9794198488photos div label {
color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}
#yiv9794198488 #yiv9794198488reco-category {
font-size:77%;}
#yiv9794198488 #yiv9794198488reco-desc {
font-size:77%;}
#yiv9794198488 .yiv9794198488replbq {
margin:4px;}
#yiv9794198488 #yiv9794198488ygrp-actbar div a:first-child {
margin-right:2px;padding-right:5px;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg {
font-size:13px;font-family:Arial, helvetica, clean,
sans-serif;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg table {
font-size:inherit;font:100%;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg select,
#yiv9794198488 input, #yiv9794198488 textarea {
font:99% Arial, Helvetica, clean, sans-serif;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg pre, #yiv9794198488
code {
font:115% monospace;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg * {
line-height:1.22em;}
#yiv9794198488 #yiv9794198488ygrp-mlmsg #yiv9794198488logo {
padding-bottom:10px;}
#yiv9794198488 #yiv9794198488ygrp-msg p a {
font-family:Verdana;}
#yiv9794198488 #yiv9794198488ygrp-msg
p#yiv9794198488attach-count span {
color:#1E66AE;font-weight:700;}
#yiv9794198488 #yiv9794198488ygrp-reco
#yiv9794198488reco-head {
color:#ff7900;font-weight:700;}
#yiv9794198488 #yiv9794198488ygrp-reco {
margin-bottom:20px;padding:0px;}
#yiv9794198488 #yiv9794198488ygrp-sponsor #yiv9794198488ov
li a {
font-size:130%;text-decoration:none;}
#yiv9794198488 #yiv9794198488ygrp-sponsor #yiv9794198488ov
li {
font-size:77%;list-style-type:square;padding:6px 0;}
#yiv9794198488 #yiv9794198488ygrp-sponsor #yiv9794198488ov
ul {
margin:0;padding:0 0 0 8px;}
#yiv9794198488 #yiv9794198488ygrp-text {
font-family:Georgia;}
#yiv9794198488 #yiv9794198488ygrp-text p {
margin:0 0 1em 0;}
#yiv9794198488 #yiv9794198488ygrp-text tt {
font-size:120%;}
#yiv9794198488 #yiv9794198488ygrp-vital ul li:last-child {
border-right:none !important;
}
#yiv9794198488
Posted by: <zhao.liqing@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar