locked
Extract Data from query with condition. RRS feed

  • Question

  • Hi Experts,

    How to display a query data in a textbox in form?

    Query contains EmpID(1), LeaveID(2), TotalTaken(10)

    I will like to display TotalTaken(10) where the LeaveID = 2 and EmpID = form!leave!EmplD

     

    I know that Dlookup is use for table only. What i didnt by lookup is ok

    =DLookUp("[AllocationForYear]","tblLeaveAllocation","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)

    Wednesday, July 13, 2011 8:33 AM

Answers

  • Hi Experts,

    How to display a query data in a textbox in form?

    Query contains EmpID(1), LeaveID(2), TotalTaken(10)

    I will like to display TotalTaken(10) where the LeaveID = 2 and EmpID = form!leave!EmplD

     

    I know that Dlookup is use for table only. What i didnt by lookup is ok

    =DLookUp("[AllocationForYear]","tblLeaveAllocation","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)


    Hi Expects,

    I tried it can work with query:- When i want to put another condition it seems to working

    =DLookUp("[TotalLeaveTaken]","qryTotalLeaveTaken","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID, "[AnnualLeaveTypeID]=3")

    Any ideals? or my last condition is wrong?

     

    Thanks.

    Regards,

    Danny


    Hi Experts,

    Finally i got my answer:

    =DLookUp("[TotalLeaveTaken]","qryTotalLeaveTaken"," [AnnualLeaveTypeID]=4 AND [EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)

    Anyway, Thanks.

    • Marked as answer by Danny Gan Wednesday, July 13, 2011 9:37 AM
    Wednesday, July 13, 2011 9:37 AM

All replies

  • Hi Experts,

    How to display a query data in a textbox in form?

    Query contains EmpID(1), LeaveID(2), TotalTaken(10)

    I will like to display TotalTaken(10) where the LeaveID = 2 and EmpID = form!leave!EmplD

     

    I know that Dlookup is use for table only. What i didnt by lookup is ok

    =DLookUp("[AllocationForYear]","tblLeaveAllocation","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)


    Hi Expects,

    I tried it can work with query:- When i want to put another condition it seems to working

    =DLookUp("[TotalLeaveTaken]","qryTotalLeaveTaken","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID, "[AnnualLeaveTypeID]=3")

    Any ideals? or my last condition is wrong?

     

    Thanks.

    Regards,

    Danny

    Wednesday, July 13, 2011 8:57 AM
  • Hi Experts,

    How to display a query data in a textbox in form?

    Query contains EmpID(1), LeaveID(2), TotalTaken(10)

    I will like to display TotalTaken(10) where the LeaveID = 2 and EmpID = form!leave!EmplD

     

    I know that Dlookup is use for table only. What i didnt by lookup is ok

    =DLookUp("[AllocationForYear]","tblLeaveAllocation","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)


    Hi Expects,

    I tried it can work with query:- When i want to put another condition it seems to working

    =DLookUp("[TotalLeaveTaken]","qryTotalLeaveTaken","[EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID, "[AnnualLeaveTypeID]=3")

    Any ideals? or my last condition is wrong?

     

    Thanks.

    Regards,

    Danny


    Hi Experts,

    Finally i got my answer:

    =DLookUp("[TotalLeaveTaken]","qryTotalLeaveTaken"," [AnnualLeaveTypeID]=4 AND [EmployeeID]= " & [Forms]![frmAnnualLeaveMain]!EmployeeID)

    Anyway, Thanks.

    • Marked as answer by Danny Gan Wednesday, July 13, 2011 9:37 AM
    Wednesday, July 13, 2011 9:37 AM