WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Query Results in unbound form field

 
   Home -> Office other -> General Discussions RSS
Next:  Sort Report  
Author Message
Brian

External


Since: Mar 16, 2006
Posts: 280



(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())));

Form Field
=DLookUp("pmtAmt","AAA",[pmtMo]=4)

getting an #Name error
Back to top
Login to vote
fredg

External


Since: Jan 30, 2004
Posts: 4633



(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
Back to top
Login to vote
Steve Sanford

External


Since: Aug 30, 2007
Posts: 42



(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
>
>
>
Back to top
Login to vote
Brian

External


Since: Mar 16, 2006
Posts: 280



(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
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office other -> General Discussions 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
Categories:
 Windows XP
 Windows Vista
 Windows Other
 Office
  Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET