latzo4
asked on
Subform Dlookup with multiple criteria
I had this dlookup working then my dbase closed and did not save the changes.
I couldn't remember how I had the last part of the following syntax, It returns #Error.
I'm trying to have a text box lookup the status of the most recent updated record (txtLastUpdated).
I couldn't remember how I had the last part of the following syntax, It returns #Error.
I'm trying to have a text box lookup the status of the most recent updated record (txtLastUpdated).
=DLookUp("[StatusName]","lkpOrderStatusState","[OrderStatusStateID]=" & [Forms]![frmViewOrder]![SubFormOrderStatus]![cboOrderStatusState] & "And [LastUpdated]=" & [Forms]![frmViewOrder]![SubFormOrderStatus] & Last([txtLastUpdated]))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm still getting #Error
I tried:
=DLookUp("[StatusName]","l kpOrderSta tusState", "[OrderSta tusStateID ]=" & [Forms]![frmViewOrder]![Su bFormOrder Status].fo rm![cboOrd erStatusSt ate] & "And [LastUpdated]= Max(" & [Forms]![frmViewOrder]![Su bFormOrder Status].fo rm![txtLas tUpdated] & ")")
and tried:
=DLookUp("[StatusName]","l kpOrderSta tusState", "[OrderSta tusStateID ]=" & [Forms]![frmViewOrder]![Su bFormOrder Status].fo rm![cboOrd erStatusSt ate] & "And [LastUpdated]= Max(#" & [Forms]![frmViewOrder]![Su bFormOrder Status].fo rm![txtLas tUpdated] & & "#)")
I tried:
=DLookUp("[StatusName]","l
and tried:
=DLookUp("[StatusName]","l
ASKER
I'd like to combine both of these, (each of these work independently):
=DLookUp("[StatusName]","l kpOrderSta tusState", "[OrderSta tusStateID ]=" & [Forms]![frmViewOrder]![Su bFormOrder Status].[F orm]![cboO rderStatus State])
combine this as the second criteria
=DMax("LastUpdated","tblOr derStatus" ,"OrderID= " & [Forms]![frmViewOrder]![Su bFormOrder Status].[F orm]![txtO rderID])
Basically the I'm trying to return the status of the most recent record date [LastUpdated].
=DLookUp("[StatusName]","l
combine this as the second criteria
=DMax("LastUpdated","tblOr
Basically the I'm trying to return the status of the most recent record date [LastUpdated].
ASKER
Thanks for the help, I'm going to post a new question with more details to see the best approach.
ASKER
I had this working yesterday but don't remember the second part of the syntax after the "And", I tried dmax, max, last and still does not get the most recent date.
=DLookUp("[StatusName]","l