Wish I could use a "if statement"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to prevent printing of a private phone number field based on a
field used to identify the number as "Public" or "Private". I seem to only
include record or bypass whole record....
 
Is this in a report or on a form?

For a report us IIF, for a form use the VB If...Then... statement.
 
I'm trying to prevent printing of a private phone number field based on a
field used to identify the number as "Public" or "Private". I seem to only
include record or bypass whole record....

In an unbound text control:
=IIf([SomeField] = "Public",[PhoneNumber],"")

Make sure the name of this control is not the same as the name of any
field used in it's control source expression.
 
Hi, Frank.
I seem to only
include record or bypass whole record....

This sounds like you're using a query, not a form or report to show
individual text boxes. It would be helpful to give enough information so
that folks answering your question don't have to guess the context of what
you're trying to do. If you are using a query, then try the following
example syntax in your query:

SELECT IIF(Nz(Status, "") = 'Public', tblMyTable.Phone, Null) AS Phone
FROM tblMyTable;

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blog: http://DataDevilDog.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top