DLookup Query Using Label Caption

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a text box that is using a DLookup to get a value for the Control
Source property. It looks like this:

=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] =' " &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & " '
")

I am currently getting a "No Current Record" error when I run this. With
the immediate window open I have verified that lblOffPeakDateOne.Caption
contains a valid string (unfortunately the data I stream is stored in string
format instead of a date). For example, it displayed todays date of
2005-06-01 (vbShortDate format).

What I can't understand is that qryCapacity will return a single value when
I copy the WHERE statement into the query and run it from there and the
database shows that there is too.

Can anyone think of something that I may be able to try?

Thanks for your time.

Lance
 
I the dlookup you should remove the space in the criteria, try this
=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] ='" &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & "'")
 
Thanks for replying Ofer. I tried removing the spaces but I still get the
error.

Ofer said:
I the dlookup you should remove the space in the criteria, try this
=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] ='" &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & "'")


LTofsrud said:
Hello,

I have a text box that is using a DLookup to get a value for the Control
Source property. It looks like this:

=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] =' " &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & " '
")

I am currently getting a "No Current Record" error when I run this. With
the immediate window open I have verified that lblOffPeakDateOne.Caption
contains a valid string (unfortunately the data I stream is stored in string
format instead of a date). For example, it displayed todays date of
2005-06-01 (vbShortDate format).

What I can't understand is that qryCapacity will return a single value when
I copy the WHERE statement into the query and run it from there and the
database shows that there is too.

Can anyone think of something that I may be able to try?

Thanks for your time.

Lance
 
Could be
When you want to refer to a field in a subform the syntax should be as
טפסי×![Form2]![Form1].Form![Country]
=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] ='" &
[Forms]![frmVirtualBoard]![subContainer].Form![lblOffPeakDateOne].Caption &
"'")

LTofsrud said:
Thanks for replying Ofer. I tried removing the spaces but I still get the
error.

Ofer said:
I the dlookup you should remove the space in the criteria, try this
=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] ='" &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & "'")


LTofsrud said:
Hello,

I have a text box that is using a DLookup to get a value for the Control
Source property. It looks like this:

=DLookUp("[SumOfVolume]","[qryCapacity]","[DeliveryStartDate] =' " &
[Forms]![frmVirtualBoard]![subContainer]![lblOffPeakDateOne].[Caption] & " '
")

I am currently getting a "No Current Record" error when I run this. With
the immediate window open I have verified that lblOffPeakDateOne.Caption
contains a valid string (unfortunately the data I stream is stored in string
format instead of a date). For example, it displayed todays date of
2005-06-01 (vbShortDate format).

What I can't understand is that qryCapacity will return a single value when
I copy the WHERE statement into the query and run it from there and the
database shows that there is too.

Can anyone think of something that I may be able to try?

Thanks for your time.

Lance
 
Back
Top