Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    If IsNull then N/A (Access 2000)

    I have a Products table that I would like to have a "N/A" show up if the value is Null. The field is named "Pages" which tells me how many pages the brochure has. However, in my Products table, there are other products that are not brochures. I would like those products to show "N/A" as I don't put in a page number in it. I am by no means an expert in VBA. I found the following code in this forum that I thought would work, but it doesn't seem to work. Any ideas?

    Private Sub Pages_AfterUpdate()
    If IsNull(Me!Pages) Then
    Me.Pages = "N/A"
    End If
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: If IsNull then N/A (Access 2000)

    You don't need VBA code for this, you can set the Format property of the Pages field instead, or of a text box on a form/report bound to the Pages field. The Format property for text fields can have two sections, separated by a semicolon. The second section determines how null values are displayed. Try setting Format to

    @;"N/A"

  3. #3
    3 Star Lounger
    Join Date
    Feb 2004
    Location
    Moundridge, Kansas, USA
    Posts
    342
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: If IsNull then N/A (Access 2000)

    Thanks a lot! That's exactly what I needed. Just a question. What does '@' mean in Access? I've seen it used in other instances.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: If IsNull then N/A (Access 2000)

    In the Format property for a text field, @ stands for any character, or for the text entered by the user.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •