(Msg. 1) Posted: Tue Jul 01, 2008 10:08 pm
Post subject: Query Results in unbound form field Archived from groups: microsoft>public>access (more info?)
I am trying to use dlookup to put the results of a query (AAA) into a form's
unbound field
AAA
SELECT Sum(Payment_tbl.pmtAmt) AS SumOfpmtAmt, Year([pmtDate]) AS pmtYear,
Month([pmtDate]) AS pmtMo
FROM Payment_tbl
GROUP BY Year([pmtDate]), Month([pmtDate])
HAVING (((Year([pmtDate]))=Year(Now())));
(Msg. 2) Posted: Tue Jul 01, 2008 10:37 pm
Post subject: Re: Query Results in unbound form field [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Tue, 1 Jul 2008 22:08:00 -0700, Brian wrote:
> I am trying to use dlookup to put the results of a query (AAA) into a form's
> unbound field
>
> AAA
> SELECT Sum(Payment_tbl.pmtAmt) AS SumOfpmtAmt, Year([pmtDate]) AS pmtYear,
> Month([pmtDate]) AS pmtMo
> FROM Payment_tbl
> GROUP BY Year([pmtDate]), Month([pmtDate])
> HAVING (((Year([pmtDate]))=Year(Now())));
>
> Form Field
> =DLookUp("pmtAmt","AAA",[pmtMo]=4)
>
> getting an #Name error
You don't have a field named "pmtAmt" in the query.
You do have a field named "SumOfpmtAmt".
Is that the value you wish to display in the control?
Does the query return just one record? If yes then:
=DLookUp("[SumOfpmtAmt]","AAA")
If there are more than one record being returned by the query then you
have to use criteria to get the correct value. The criteria argument
must be a string.
=DLookUp("[SumOfpmtAmt]","AAA","[pmtMo] = 4")
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
(Msg. 3) Posted: Tue Jul 01, 2008 10:58 pm
Post subject: RE: Query Results in unbound form field [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Hi Brian,
The problem as I see it is the query does not have a field "pmtAmt" (the
"FieldToLookIn" in the DLookUp()).
Try:
Form Field
=DLookUp("SumOfpmtAmt","AAA",[pmtMo]=4)
HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)
"Brian" wrote:
> I am trying to use dlookup to put the results of a query (AAA) into a form's
> unbound field
>
> AAA
> SELECT Sum(Payment_tbl.pmtAmt) AS SumOfpmtAmt, Year([pmtDate]) AS pmtYear,
> Month([pmtDate]) AS pmtMo
> FROM Payment_tbl
> GROUP BY Year([pmtDate]), Month([pmtDate])
> HAVING (((Year([pmtDate]))=Year(Now())));
>
> Form Field
> =DLookUp("pmtAmt","AAA",[pmtMo]=4)
>
> getting an #Name error
>
>
>
(Msg. 4) Posted: Wed Jul 02, 2008 7:42 am
Post subject: Re: Query Results in unbound form field [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Oh dang, it's always the simple things
Thanks, you guys are awsome !!!
"fredg" wrote:
> On Tue, 1 Jul 2008 22:08:00 -0700, Brian wrote:
>
> > I am trying to use dlookup to put the results of a query (AAA) into a form's
> > unbound field
> >
> > AAA
> > SELECT Sum(Payment_tbl.pmtAmt) AS SumOfpmtAmt, Year([pmtDate]) AS pmtYear,
> > Month([pmtDate]) AS pmtMo
> > FROM Payment_tbl
> > GROUP BY Year([pmtDate]), Month([pmtDate])
> > HAVING (((Year([pmtDate]))=Year(Now())));
> >
> > Form Field
> > =DLookUp("pmtAmt","AAA",[pmtMo]=4)
> >
> > getting an #Name error
>
> You don't have a field named "pmtAmt" in the query.
> You do have a field named "SumOfpmtAmt".
> Is that the value you wish to display in the control?
> Does the query return just one record? If yes then:
>
> =DLookUp("[SumOfpmtAmt]","AAA")
>
> If there are more than one record being returned by the query then you
> have to use criteria to get the correct value. The criteria argument
> must be a string.
> =DLookUp("[SumOfpmtAmt]","AAA","[pmtMo] = 4")
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
>
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum