dlookup or dsum

S

smason

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
 
J

Jeff Boyce

"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
 
F

fredg

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
 
S

smason

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 said:
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
 
D

Douglas J. Steele

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

(no e-mails, please!)



smason said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top