DLookUp Code!

B

Bob V

This Text Box Code on my Report is not quite working, tbOwnerID Control
Source is: =Val(Forms!frmBillStatement!cbOwnerName)
I am getting #Name? Error
Thanks for any Help....Bob
="Last Payment " & Format(DLookUp("[BillDate]","qryAccountStatus","[OwnerID]
= " & Me!tbOwnerID & ""),"d-mmm-yy") & " " &
Format(DLookUp("[PaidAmount]","qryAccountStatus","[OwnerID] = " &
Me!tbOwnerID & ""),"$ #,##0.00")
 
J

John W. Vinson

This Text Box Code on my Report is not quite working, tbOwnerID Control
Source is: =Val(Forms!frmBillStatement!cbOwnerName)
I am getting #Name? Error
Thanks for any Help....Bob
="Last Payment " & Format(DLookUp("[BillDate]","qryAccountStatus","[OwnerID]
= " & Me!tbOwnerID & ""),"d-mmm-yy") & " " &
Format(DLookUp("[PaidAmount]","qryAccountStatus","[OwnerID] = " &
Me!tbOwnerID & ""),"$ #,##0.00")

What's the point of the Val() function? It returns a numeric value from a text
string. What's the Recordsource of the form? Why not simply include the owner
name field in the query, rather than trying to retrieve a value from a combo
box on a Form (which might not even be open)?

And what is all the "spinach" after your signature? Other control sources that
aren't working or what?


John W. Vinson [MVP]
 
B

Bob V

Thanks John, This report does not have a record Source and contains a sub
Form :Report.rptSubOwnerInvoiceAmount
tbOwnerID is working perfect, its the DLookUp (Spinach)that I cant seem to
get to work
Thanks for your help..Bob

John W. Vinson said:
This Text Box Code on my Report is not quite working, tbOwnerID Control
Source is: =Val(Forms!frmBillStatement!cbOwnerName)
I am getting #Name? Error
Thanks for any Help....Bob
="Last Payment " &
Format(DLookUp("[BillDate]","qryAccountStatus","[OwnerID]
= " & Me!tbOwnerID & ""),"d-mmm-yy") & " " &
Format(DLookUp("[PaidAmount]","qryAccountStatus","[OwnerID] = " &
Me!tbOwnerID & ""),"$ #,##0.00")

What's the point of the Val() function? It returns a numeric value from a
text
string. What's the Recordsource of the form? Why not simply include the
owner
name field in the query, rather than trying to retrieve a value from a
combo
box on a Form (which might not even be open)?

And what is all the "spinach" after your signature? Other control sources
that
aren't working or what?


John W. Vinson [MVP]
 
S

Steve Schapel

Bob,

The use of Me! is only applicable in VBA code. You appear to be trying
to use this in an expression in the Control Source property of a control
on your report. This won't work.
 
J

John W. Vinson

Thanks John, This report does not have a record Source and contains a sub
Form :Report.rptSubOwnerInvoiceAmount
tbOwnerID is working perfect, its the DLookUp (Spinach)that I cant seem to
get to work

Well, it certainly won't work as written - but a) you don't say anything about
the Report that it's on, b) anything about the form, or c) explain what you're
trying to accomplish.

Some background please, so someone who cannot see your computer screen might
have a chance to help?

John W. Vinson [MVP]
 
B

Bob V

On my Report I have 2 text boxes One Shows the date of the last payment and
the other shows the Amount
Both work fine separately, what I wanted 2 do was combine them with the
words "Last Payment" in front of them and format them d-mmm-yy and
($#,##0.00)
=DLookUp("BillDate","qryAccountStatus","OwnerID=" & [tbOwnerID])
=DLookUp("PaidAmount","qryAccountStatus","OwnerID=" & [tbOwnerID])
Thanks for the help....Bob
 
D

Douglas J. Steele

="Last Payment " & Format(DLookUp("BillDate","qryAccountStatus","OwnerID=" &
[tbOwnerID]), "d-mmm-yy") & " " &
Format(DLookUp("PaidAmount","qryAccountStatus","OwnerID=" & [tbOwnerID]),
"Currency")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bob V said:
On my Report I have 2 text boxes One Shows the date of the last payment
and the other shows the Amount
Both work fine separately, what I wanted 2 do was combine them with the
words "Last Payment" in front of them and format them d-mmm-yy and
($#,##0.00)
=DLookUp("BillDate","qryAccountStatus","OwnerID=" & [tbOwnerID])
=DLookUp("PaidAmount","qryAccountStatus","OwnerID=" & [tbOwnerID])
Thanks for the help....Bob

John W. Vinson said:
Well, it certainly won't work as written - but a) you don't say anything
about
the Report that it's on, b) anything about the form, or c) explain what
you're
trying to accomplish.

Some background please, so someone who cannot see your computer screen
might
have a chance to help?

John W. Vinson [MVP]
 
B

Bob V

Brilliant Thanks Douglas :) ...............Bob

Douglas J. Steele said:
="Last Payment " & Format(DLookUp("BillDate","qryAccountStatus","OwnerID="
& [tbOwnerID]), "d-mmm-yy") & " " &
Format(DLookUp("PaidAmount","qryAccountStatus","OwnerID=" & [tbOwnerID]),
"Currency")


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Bob V said:
On my Report I have 2 text boxes One Shows the date of the last payment
and the other shows the Amount
Both work fine separately, what I wanted 2 do was combine them with the
words "Last Payment" in front of them and format them d-mmm-yy and
($#,##0.00)
=DLookUp("BillDate","qryAccountStatus","OwnerID=" & [tbOwnerID])
=DLookUp("PaidAmount","qryAccountStatus","OwnerID=" & [tbOwnerID])
Thanks for the help....Bob

John W. Vinson said:
Thanks John, This report does not have a record Source and contains a
sub
Form :Report.rptSubOwnerInvoiceAmount
tbOwnerID is working perfect, its the DLookUp (Spinach)that I cant seem
to
get to work

Well, it certainly won't work as written - but a) you don't say anything
about
the Report that it's on, b) anything about the form, or c) explain what
you're
trying to accomplish.

Some background please, so someone who cannot see your computer screen
might
have a chance to help?

John W. Vinson [MVP]
 

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

Format on report Problem 4
Help with a DLookUp 3
DLookup for Report! 4
Change to report code needed 3
Adding a Blank between Names! 1
First Character of First Name! 5
Where did i go wrong 1
Format Problem 1

Top