Solved

How make data print on report if form field is blank

Posted on 2013-12-19
3
555 Views
Last Modified: 2013-12-20
I have a field on a report and the control source is:

=[Forms]![frmSelectDateRangeSourceOfSalesRpt]![txtMemberName]

But if the field on the form is blank I want the field to print "All Members"

Here is the on print code I have but it doesn't work.

    If Me.txtTeamMember = "" Then
        Me.txtTeamMember = "All Members"
    End If
0
Comment
Question by:SteveL13
3 Comments
 
LVL 30

Expert Comment

by:hnasr
ID: 39730408
Try On Format event.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39730415
You don't need the VBA.

Just set the control source as follows:


=iif ( Trim("" & [Forms]![frmSelectDateRangeSourceOfSalesRpt]![txtMemberName]) = "", "ALL MEMBERS",  [Forms]![frmSelectDateRangeSourceOfSalesRpt]![txtMemberName])

Open in new window

0
 
LVL 34

Expert Comment

by:PatHartman
ID: 39730861
"" is a ZLS (zero length string) and is different from Null.  The following code simplifies the test for both values.  It concatenates a ZLS with the field and then tests to see if it is still equal to a ZLS.  This takes advantage of the concatenation properties of & when dealing with a null value because when you concatenate a ZLS with Null, you end up with a ZLS.

    If Me.txtTeamMember & "" = "" Then
        Me.txtTeamMember = "All Members"
    End If 

Open in new window

0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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 functions 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 Ac…
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.

708 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

20 Experts available now in Live!

Get 1:1 Help Now