Dear Duane,
Thanks a lot of your reply. I followed your instruction. 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
Zhao LiQing
Be adventurous, be bold, be careful, be a star !
--------------------------------------------
On Sun, 1/20/19, Duane Hookom duanehookom@hotmail.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" <MS_Access_Professionals@yahoogroups.com>
Date: Sunday, January 20, 2019, 1:14 PM
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
#yiv0308805629 #yiv0308805629 --
#yiv0308805629ygrp-mkp {
border:1px solid #d8d8d8;font-family:Arial;margin:10px
0;padding:0 10px;}
#yiv0308805629 #yiv0308805629ygrp-mkp hr {
border:1px solid #d8d8d8;}
#yiv0308805629 #yiv0308805629ygrp-mkp #yiv0308805629hd {
color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}
#yiv0308805629 #yiv0308805629ygrp-mkp #yiv0308805629ads {
margin-bottom:10px;}
#yiv0308805629 #yiv0308805629ygrp-mkp .yiv0308805629ad {
padding:0 0;}
#yiv0308805629 #yiv0308805629ygrp-mkp .yiv0308805629ad p {
margin:0;}
#yiv0308805629 #yiv0308805629ygrp-mkp .yiv0308805629ad a {
color:#0000ff;text-decoration:none;}
#yiv0308805629 #yiv0308805629ygrp-sponsor
#yiv0308805629ygrp-lc {
font-family:Arial;}
#yiv0308805629 #yiv0308805629ygrp-sponsor
#yiv0308805629ygrp-lc #yiv0308805629hd {
margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}
#yiv0308805629 #yiv0308805629ygrp-sponsor
#yiv0308805629ygrp-lc .yiv0308805629ad {
margin-bottom:10px;padding:0 0;}
#yiv0308805629 #yiv0308805629actions {
font-family:Verdana;font-size:11px;padding:10px 0;}
#yiv0308805629 #yiv0308805629activity {
background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}
#yiv0308805629 #yiv0308805629activity span {
font-weight:700;}
#yiv0308805629 #yiv0308805629activity span:first-child {
text-transform:uppercase;}
#yiv0308805629 #yiv0308805629activity span a {
color:#5085b6;text-decoration:none;}
#yiv0308805629 #yiv0308805629activity span span {
color:#ff7900;}
#yiv0308805629 #yiv0308805629activity span
.yiv0308805629underline {
text-decoration:underline;}
#yiv0308805629 .yiv0308805629attach {
clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}
#yiv0308805629 .yiv0308805629attach div a {
text-decoration:none;}
#yiv0308805629 .yiv0308805629attach img {
border:none;padding-right:5px;}
#yiv0308805629 .yiv0308805629attach label {
display:block;margin-bottom:5px;}
#yiv0308805629 .yiv0308805629attach label a {
text-decoration:none;}
#yiv0308805629 blockquote {
margin:0 0 0 4px;}
#yiv0308805629 .yiv0308805629bold {
font-family:Arial;font-size:13px;font-weight:700;}
#yiv0308805629 .yiv0308805629bold a {
text-decoration:none;}
#yiv0308805629 dd.yiv0308805629last p a {
font-family:Verdana;font-weight:700;}
#yiv0308805629 dd.yiv0308805629last p span {
margin-right:10px;font-family:Verdana;font-weight:700;}
#yiv0308805629 dd.yiv0308805629last p
span.yiv0308805629yshortcuts {
margin-right:0;}
#yiv0308805629 div.yiv0308805629attach-table div div a {
text-decoration:none;}
#yiv0308805629 div.yiv0308805629attach-table {
width:400px;}
#yiv0308805629 div.yiv0308805629file-title a, #yiv0308805629
div.yiv0308805629file-title a:active, #yiv0308805629
div.yiv0308805629file-title a:hover, #yiv0308805629
div.yiv0308805629file-title a:visited {
text-decoration:none;}
#yiv0308805629 div.yiv0308805629photo-title a,
#yiv0308805629 div.yiv0308805629photo-title a:active,
#yiv0308805629 div.yiv0308805629photo-title a:hover,
#yiv0308805629 div.yiv0308805629photo-title a:visited {
text-decoration:none;}
#yiv0308805629 div#yiv0308805629ygrp-mlmsg
#yiv0308805629ygrp-msg p a span.yiv0308805629yshortcuts {
font-family:Verdana;font-size:10px;font-weight:normal;}
#yiv0308805629 .yiv0308805629green {
color:#628c2a;}
#yiv0308805629 .yiv0308805629MsoNormal {
margin:0 0 0 0;}
#yiv0308805629 o {
font-size:0;}
#yiv0308805629 #yiv0308805629photos div {
float:left;width:72px;}
#yiv0308805629 #yiv0308805629photos div div {
border:1px solid
#666666;min-height:62px;overflow:hidden;width:62px;}
#yiv0308805629 #yiv0308805629photos div label {
color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}
#yiv0308805629 #yiv0308805629reco-category {
font-size:77%;}
#yiv0308805629 #yiv0308805629reco-desc {
font-size:77%;}
#yiv0308805629 .yiv0308805629replbq {
margin:4px;}
#yiv0308805629 #yiv0308805629ygrp-actbar div a:first-child {
margin-right:2px;padding-right:5px;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg {
font-size:13px;font-family:Arial, helvetica, clean,
sans-serif;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg table {
font-size:inherit;font:100%;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg select,
#yiv0308805629 input, #yiv0308805629 textarea {
font:99% Arial, Helvetica, clean, sans-serif;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg pre, #yiv0308805629
code {
font:115% monospace;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg * {
line-height:1.22em;}
#yiv0308805629 #yiv0308805629ygrp-mlmsg #yiv0308805629logo {
padding-bottom:10px;}
#yiv0308805629 #yiv0308805629ygrp-msg p a {
font-family:Verdana;}
#yiv0308805629 #yiv0308805629ygrp-msg
p#yiv0308805629attach-count span {
color:#1E66AE;font-weight:700;}
#yiv0308805629 #yiv0308805629ygrp-reco
#yiv0308805629reco-head {
color:#ff7900;font-weight:700;}
#yiv0308805629 #yiv0308805629ygrp-reco {
margin-bottom:20px;padding:0px;}
#yiv0308805629 #yiv0308805629ygrp-sponsor #yiv0308805629ov
li a {
font-size:130%;text-decoration:none;}
#yiv0308805629 #yiv0308805629ygrp-sponsor #yiv0308805629ov
li {
font-size:77%;list-style-type:square;padding:6px 0;}
#yiv0308805629 #yiv0308805629ygrp-sponsor #yiv0308805629ov
ul {
margin:0;padding:0 0 0 8px;}
#yiv0308805629 #yiv0308805629ygrp-text {
font-family:Georgia;}
#yiv0308805629 #yiv0308805629ygrp-text p {
margin:0 0 1em 0;}
#yiv0308805629 #yiv0308805629ygrp-text tt {
font-size:120%;}
#yiv0308805629 #yiv0308805629ygrp-vital ul li:last-child {
border-right:none !important;
}
#yiv0308805629
Posted by: <zhao.liqing@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
Tidak ada komentar:
Posting Komentar