|  | dlookup or dsum |  | |
| | | smason |  |
| Posted: Thu Sep 04, 2008 1:58 pm Post subject: dlookup or dsum |  |
hello i have writen this code in a form called frminput =DLookUp("[amount]","[qryamttotal]","[jobid]= " & [Forms]![frminput]![jobno])
to retrieve a sum cell in a query(qryamttottal) called 'Amount' the field in the form is 'jobno' and i am tring to link this to 'jobid' and the query which are the same but i am getting an error message in the text box any ideas |
| |
| | | Jeff Boyce |  |
| Posted: Thu Sep 04, 2008 2:27 pm Post subject: Re: dlookup or dsum |  |
"getting an error message" doesn't give us much to go on...
More specific description may lead to more specific suggestions.
Regards
Jeff Boyce Microsoft Office/Access MVP
"smason" <smason@discussions.microsoft.com> wrote in message news:67AA2E02-42FD-4B61-A53A-A0BA1AABABED@microsoft.com...
| Quote: | hello i have writen this code in a form called frminput =DLookUp("[amount]","[qryamttotal]","[jobid]= " & [Forms]![frminput]![jobno])
to retrieve a sum cell in a query(qryamttottal) called 'Amount' the field in the form is 'jobno' and i am tring to link this to 'jobid' and the query which are the same but i am getting an error message in the text box any ideas |
|
| |
| | | fredg |  |
| Posted: Thu Sep 04, 2008 3:03 pm Post subject: Re: dlookup or dsum |  |
On Thu, 4 Sep 2008 08:58:01 -0700, smason wrote:
| Quote: | hello i have writen this code in a form called frminput =DLookUp("[amount]","[qryamttotal]","[jobid]= " & [Forms]![frminput]![jobno])
to retrieve a sum cell in a query(qryamttottal) called 'Amount' the field in the form is 'jobno' and i am tring to link this to 'jobid' and the query which are the same but i am getting an error message in the text box any ideas
|
Access tables and queries do not have 'cells', they have fields. Forms do not have fields, they have controls.
What is the error message? What version of Access? What is the datatype of [jobid]?
As written, your syntax indicates that [jobid] is a Number datatype.
If, in fact, it is a text datatype then use: "[jobid]= '" & Me]![jobno] & "'"
Note: the Me! keyword replaces forms!frminput
-- Fred Please respond only to this newsgroup. I do not reply to personal e-mail |
| |
| | | smason |  |
| Posted: Fri Sep 05, 2008 6:25 am Post subject: Re: dlookup or dsum |  |
| |  | |
thank you fredJ
how ever i tried this =DLookUp("[amount]","[qryamttotal]","[jobid] = '" & [me]![jobid] & "") and i get an error in the text box saying #Name
"fredg" wrote:
| Quote: | On Thu, 4 Sep 2008 08:58:01 -0700, smason wrote:
hello i have writen this code in a form called frminput =DLookUp("[amount]","[qryamttotal]","[jobid]= " & [Forms]![frminput]![jobno])
to retrieve a sum cell in a query(qryamttottal) called 'Amount' the field in the form is 'jobno' and i am tring to link this to 'jobid' and the query which are the same but i am getting an error message in the text box any ideas
Access tables and queries do not have 'cells', they have fields. Forms do not have fields, they have controls.
What is the error message? What version of Access? What is the datatype of [jobid]?
As written, your syntax indicates that [jobid] is a Number datatype.
If, in fact, it is a text datatype then use: "[jobid]= '" & Me]![jobno] & "'"
Note: the Me! keyword replaces forms!frminput
-- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
| |
| | | Douglas J. Steele |  |
| Posted: Fri Sep 05, 2008 8:59 am Post subject: Re: dlookup or dsum |  |
| |  | |
You appear to have a single quote before the value of jobid, but not after.
It would also appear from the equal sign in front that you're trying to use the DLookup as the ControlSource for a text box. You cannot use Me in that context: you must use the complete reference to the form (or else just put the control name with no qualfication)
=DLookUp("[amount]","[qryamttotal]","[jobid] = '" & [Forms]![FormName]![jobid] & "'")
or
=DLookUp("[amount]","[qryamttotal]","[jobid] = '" & [jobid] & "'")
-- Doug Steele, Microsoft Access MVP LINK (no e-mails, please!)
"smason" <smason@discussions.microsoft.com> wrote in message news:4A429DD6-4DD4-460F-BD59-DBA0C6DDDAA4@microsoft.com...
| Quote: | thank you fredJ
how ever i tried this =DLookUp("[amount]","[qryamttotal]","[jobid] = '" & [me]![jobid] & "") and i get an error in the text box saying #Name
"fredg" wrote:
On Thu, 4 Sep 2008 08:58:01 -0700, smason wrote:
hello i have writen this code in a form called frminput =DLookUp("[amount]","[qryamttotal]","[jobid]= " & [Forms]![frminput]![jobno])
to retrieve a sum cell in a query(qryamttottal) called 'Amount' the field in the form is 'jobno' and i am tring to link this to 'jobid' and the query which are the same but i am getting an error message in the text box any ideas
Access tables and queries do not have 'cells', they have fields. Forms do not have fields, they have controls.
What is the error message? What version of Access? What is the datatype of [jobid]?
As written, your syntax indicates that [jobid] is a Number datatype.
If, in fact, it is a text datatype then use: "[jobid]= '" & Me]![jobno] & "'"
Note: the Me! keyword replaces forms!frminput
-- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
| |
|
|