Solved

Another DLookup VBA syntax issue

Posted on 2013-12-02
3
353 Views
Last Modified: 2013-12-02
What is wrong with this?

    Me.txtListingsTakenGoal = Nz(DLookup("[ListingsCount]", "tblMemberGoals", "[TeamMember] = " &  Forms!frmSelectDateRangeAndMembers!txtMemberName & " And [GoalMonth] = " &  Forms!frmSelectDateRangeAndMembers!txtMonth And [GoalYear] = " &  Forms!frmSelectDateRangeAndMembers!txtYear)&", 0)
0
Comment
Question by:SteveL13
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39689950
    Me.txtListingsTakenGoal = Nz(DLookup("[ListingsCount]", "tblMemberGoals", "[TeamMember] = " &  Forms!frmSelectDateRangeAndMembers!txtMemberName & " And [GoalMonth] = " &  Forms!frmSelectDateRangeAndMembers!txtMonth & " And [GoalYear] = " &  Forms!frmSelectDateRangeAndMembers!txtYear), 0) 

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 39689961
And like your other question, if TeamMember is text, use quotes as delimiters.  The above assumes a numeric ID:

    Me.txtListingsTakenGoal = Nz(DLookup("[ListingsCount]", "tblMemberGoals", "[TeamMember] = '" &  Forms!frmSelectDateRangeAndMembers!txtMemberName & "' And [GoalMonth] = " &  Forms!frmSelectDateRangeAndMembers!txtMonth & " And [GoalYear] = " &  Forms!frmSelectDateRangeAndMembers!txtYear), 0) 

Open in new window

0
 

Author Comment

by:SteveL13
ID: 39690004
Is numeric.  But now I have to add yet another criteria.  Please watch for another topic question.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now