Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dLookup with multiple conditions? 1

Status
Not open for further replies.

bendixen

Technical User
May 3, 2007
15
US
Is it possible to have multiple conditions in the criteria field of a dLookup command? I want to autopopulate a value into a form if both pieces of critera are met.

The table I'm pulling the information from has the same person (UID) several times, but only one time per project number (Seqnum). I am entering the SeqNum and UID values into the form. I want to pull in the other information (Employee Role and RIS Funded Effort %) from that table.

Here's the code I'm working on. I need the Dlookups to be both [UID] & [Seqnum] ='"... but I'm just not understanding how.


Private Sub UID_AfterUpdate()

Dim strEmployeeRole As String
Dim strRISFundedEffort As String

strEmployeeRole = Nz(DLookup("[Employee Role]", "tbl_RISinfoPull", "[UID]='" & Me![UID] & "'"))
strRISFundedEffort = Nz(DLookup("[RIS Funded Effort %]", "tbl_RISinfoPull", "[Seqnum]='" & Me![SeqNum] & "'"))

Me.Employee_Role = strEmployeeRole
Me.UIRISFundedEffort = strRISFundedEffort

End Sub


Thanks for any assistance in helping me understand this.
 
[UID]='" & Me![UID] & "' and [Seqnum]='" & Me![SeqNum] & "'"))
 
Worked great except for in the field that's also a combo box (so entry can be added if the person isn't in the other table. I'll have to work on figuring that out now. Thanks so much for the help pwise!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top