MarcusAD79
New member
- Local time
- Today, 09:08
- Joined
- Dec 13, 2020
- Messages
- 3
Hi,
I have been trying for hours to get the following DLookup to work. I've read forum after forum and help pages to no avail.
Problem :
DLookUp("[DIFFRERENCE]","qrySubUsage","MeterID=" & [Sub1MeterID] And "CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#")
Source Query "qrySubUsage" has the following fields:
MeterID | PREVIOUS_READ_DATE | PREVIOUS_READ | CURRENT_READ | CURRENT_READ_DATE | DIFFERENCE | (There are other fields that aren't used)
qrySubUsage : DIFFERENCE is subtracting the Previous read amount from the Current. This works.
Where the problem is, some of the meters have sub-meters; the power they use is recorded in the parent meter.
I am trying to create a query that will display the DIFFERENCE from the sub meter in a field for the parent meter for each date.
The "qryUsage" is a copy of "qrySubUsage" with extra fields:
MeterID | PREVIOUS_READ_DATE | PREVIOUS_READ | CURRENT_READ | CURRENT_READ_DATE | DIFFERENCE | Sub1MeterID | Sub1Usage | ByMeter | ByDate
Sub1Usage = DLookUp("[DIFFRERENCE]","qrySubUsage","MeterID=" & [Sub1MeterID] And "CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#")
I also tried to break it up into two DLookups to try to figure out the problem, but neither work correctly.
ByDate: DLookUp("[DIFFRERENCE]","qrySubUsage","CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#") = Does pull DIFFERENCE, but only for the first four dates and then just repeats them.
ByMeter: DLookUp("DIFFRERENCE","qrySubUsage","MeterID=" & [Sub1MeterID]) = Pulls the first DIFFENCE and repeats it.
Any help would be great.
Thank you!
I have been trying for hours to get the following DLookup to work. I've read forum after forum and help pages to no avail.
Problem :
DLookUp("[DIFFRERENCE]","qrySubUsage","MeterID=" & [Sub1MeterID] And "CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#")
Source Query "qrySubUsage" has the following fields:
MeterID | PREVIOUS_READ_DATE | PREVIOUS_READ | CURRENT_READ | CURRENT_READ_DATE | DIFFERENCE | (There are other fields that aren't used)
qrySubUsage : DIFFERENCE is subtracting the Previous read amount from the Current. This works.
Where the problem is, some of the meters have sub-meters; the power they use is recorded in the parent meter.
I am trying to create a query that will display the DIFFERENCE from the sub meter in a field for the parent meter for each date.
The "qryUsage" is a copy of "qrySubUsage" with extra fields:
MeterID | PREVIOUS_READ_DATE | PREVIOUS_READ | CURRENT_READ | CURRENT_READ_DATE | DIFFERENCE | Sub1MeterID | Sub1Usage | ByMeter | ByDate
Sub1Usage = DLookUp("[DIFFRERENCE]","qrySubUsage","MeterID=" & [Sub1MeterID] And "CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#")
I also tried to break it up into two DLookups to try to figure out the problem, but neither work correctly.
ByDate: DLookUp("[DIFFRERENCE]","qrySubUsage","CURRENT_READ_DATE=#" & [CURRENT_READ_DATE] & "#") = Does pull DIFFERENCE, but only for the first four dates and then just repeats them.
ByMeter: DLookUp("DIFFRERENCE","qrySubUsage","MeterID=" & [Sub1MeterID]) = Pulls the first DIFFENCE and repeats it.
Any help would be great.
Thank you!