S syedadnan Access Lover Local time Today, 08:16 Joined Mar 27, 2013 Messages 315 Jul 26, 2016 #1 Regards, I am stuck here with a problem that i need a dlookup value of field "A_bal" with respect to bank id "BID" and max of date field "Tdate". The query name is TNS an image is attacched Attachments Dmax.png 14.9 KB · Views: 238
Regards, I am stuck here with a problem that i need a dlookup value of field "A_bal" with respect to bank id "BID" and max of date field "Tdate". The query name is TNS an image is attacched
Ranman256 Well-known member Local time Today, 00:16 Joined Apr 9, 2015 Messages 4,353 Jul 26, 2016 #2 make 2 queries. Q1 is: select ID, MAX(date) from tabl (now you know the max date of each ID) now get the balance... Q2 uses Q1 and tabl , then the ID in Q1 to pull the balance, join the 2 on ID.
make 2 queries. Q1 is: select ID, MAX(date) from tabl (now you know the max date of each ID) now get the balance... Q2 uses Q1 and tabl , then the ID in Q1 to pull the balance, join the 2 on ID.
jdraw Super Moderator Staff member Local time Today, 00:16 Joined Jan 23, 2006 Messages 15,585 Jul 26, 2016 #3 DLookup Something along this lineuntested) DesiredValue = DLookup("a_bal","yourtableOrQueryName","aBID=" & txtBID & " and TDate =#" &TDate & "#") Need more context for the issue to do a test.
DLookup Something along this lineuntested) DesiredValue = DLookup("a_bal","yourtableOrQueryName","aBID=" & txtBID & " and TDate =#" &TDate & "#") Need more context for the issue to do a test.
S syedadnan Access Lover Local time Today, 08:16 Joined Mar 27, 2013 Messages 315 Jul 27, 2016 #4 jdraw said: DLookup Something along this lineuntested) DesiredValue = DLookup("a_bal","yourtableOrQueryName","aBID=" & txtBID & " and TDate =#" &TDate & "#") Need more context for the issue to do a test. Click to expand... Not working.. as for what i need..
jdraw said: DLookup Something along this lineuntested) DesiredValue = DLookup("a_bal","yourtableOrQueryName","aBID=" & txtBID & " and TDate =#" &TDate & "#") Need more context for the issue to do a test. Click to expand... Not working.. as for what i need..
S syedadnan Access Lover Local time Today, 08:16 Joined Mar 27, 2013 Messages 315 Jul 27, 2016 #5 Ranman256 said: make 2 queries. Q1 is: select ID, MAX(date) from tabl (now you know the max date of each ID) now get the balance... Q2 uses Q1 and tabl , then the ID in Q1 to pull the balance, join the 2 on ID. Click to expand... Not working.. i think something with dlookup and dmax nest will work.. waiting for any other idea
Ranman256 said: make 2 queries. Q1 is: select ID, MAX(date) from tabl (now you know the max date of each ID) now get the balance... Q2 uses Q1 and tabl , then the ID in Q1 to pull the balance, join the 2 on ID. Click to expand... Not working.. i think something with dlookup and dmax nest will work.. waiting for any other idea
arnelgp ..forever waiting... waiting for jellybean! Local time Today, 12:16 Joined May 7, 2009 Messages 20,669 Jul 27, 2016 #6 SELECT DISTINCT T1.BID, CDATE(DMax("TDATE","yourTABLE","BID=" & T1.BID)) AS TDATE, CDbl(DLookUp("A_BAL","yourTABLE","BID=" & [T1].[BID] & " AND TDATE=#" & DMax("TDATE","yourTABLE","BID=" & [T1].[BID]) & "#")) AS A_BAL FROM yourTABLE AS T1;
SELECT DISTINCT T1.BID, CDATE(DMax("TDATE","yourTABLE","BID=" & T1.BID)) AS TDATE, CDbl(DLookUp("A_BAL","yourTABLE","BID=" & [T1].[BID] & " AND TDATE=#" & DMax("TDATE","yourTABLE","BID=" & [T1].[BID]) & "#")) AS A_BAL FROM yourTABLE AS T1;
S syedadnan Access Lover Local time Today, 08:16 Joined Mar 27, 2013 Messages 315 Jul 27, 2016 #7 arnelgp said: SELECT DISTINCT T1.BID, CDATE(DMax("TDATE","yourTABLE","BID=" & T1.BID)) AS TDATE, CDbl(DLookUp("A_BAL","yourTABLE","BID=" & [T1].[BID] & " AND TDATE=#" & DMax("TDATE","yourTABLE","BID=" & [T1].[BID]) & "#")) AS A_BAL FROM yourTABLE AS T1; Click to expand... WOW !! Thats great cent percent to the requirement... Thanks a billion have a nice day...
arnelgp said: SELECT DISTINCT T1.BID, CDATE(DMax("TDATE","yourTABLE","BID=" & T1.BID)) AS TDATE, CDbl(DLookUp("A_BAL","yourTABLE","BID=" & [T1].[BID] & " AND TDATE=#" & DMax("TDATE","yourTABLE","BID=" & [T1].[BID]) & "#")) AS A_BAL FROM yourTABLE AS T1; Click to expand... WOW !! Thats great cent percent to the requirement... Thanks a billion have a nice day...