Results 1 to 2 of 2
  1. #1
    Fionn is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    13

    If text box exists in Expression builder?

    Hi, In a query I want to put into the criteria of a field
    Code:
    IIf(IsExists([Forms]![frmDailyClass]![txtTerm]),4,[Forms]![frmDailyClass]![txtTerm])"
    But there is no IsExists only IsEmpty or IsNull and these both pop up a box asking for the value of txtTerm. Anyone know if there's a way of setting the value as 4 unless txtTerm exists and has a value in it? Thanks

  2. #2
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Are you attempting to test if the control exists? For instance, if your code is dynamically creating controls on a form at run time? Or are you just trying to determine if there is data in the underlying table?

    If the control will always be there, and you only care whether there is data, then IsNull is a correct choice. That would look like this:
    Code:
    IIF(IsNull([Forms]![frmDailyClass]![txtTerm]),4,[Forms]![frmDailyClass]![txtTerm])
    There's also a great function called NZ that was defined for exactly this situation, and allows you to efficiently override Nulls with your desired default value. That would look like this:
    Code:
    NZ([Forms]![frmDailyClass]![txtTerm],4)

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  2. Text Box Expression Builder with Queries
    By blacksaibot in forum Access
    Replies: 7
    Last Post: 01-10-2012, 10:07 AM
  3. expression builder
    By tonyl in forum Access
    Replies: 3
    Last Post: 11-26-2011, 12:00 AM
  4. Expression Builder or VB ... Help
    By Adynn in forum Access
    Replies: 0
    Last Post: 06-03-2011, 09:51 AM
  5. Expression Builder
    By mistaken_myst in forum Access
    Replies: 2
    Last Post: 05-07-2008, 01:30 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums