+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    05-20-2008
    MS-Off Ver
    2003 suite
    Posts
    64

    Question How to hide '0' shown in empty fields (Access form)

    Hello

    I'm creating a form in Access 2003 and would like to hid the 0's shown in the empty fields of a new record.

    Any suggestions would be appreciated!


    I did find one mention somewhere else on the interwebs that said I should put this in the form code:

    Code:
    Private Sub Form_Current()
        Me.FieldName.Visible = (Me.FieldName > 0)
    End Sub
    Is there a way to make this apply to all of the fields, without having to copy/paste that line for each different field in the form?

    Thanks!
    Last edited by WillysK5; 05-21-2009 at 05:44 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    233

    Re: How to hide '0' shown in empty fields (Access form)

    The code you linked isn't going to make the "0" disapear, it will remove the entire field from the form(visibly anyway). I am not sure if that is what you are shooting for. I am not sure how the 0 got there in the first place. One thing you might be able to do is remove the default 0 from the field in table design view. If it is putting a 0 there by default. Otherwise it is going to require code to manipulate the data.

    Something like:
    Code:
    If me.fieldname = "0" then
       Me.fieldname.ForeColor=#FFFFFF
    Else
       me.fieldname.forecolor=#000000
    End if
    Hope this helps,

    Dan
    "I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
    If my advice has been helpful to you, then please help me by clicking on the scales and adding to my reputation, Thanks!

  3. #3
    Registered User
    Join Date
    05-20-2008
    MS-Off Ver
    2003 suite
    Posts
    64

    Re: How to hide '0' shown in empty fields (Access form)

    I don't want to removed the whole field, just hide the 0 which automatically shows up in the field.

    Yeah, I don't really know why there's a 0 either. As far as I can tell, there's no properties setting that forces a 0 to be there.

    I'll try the color thing and let you know.

    Thanks!
    Last edited by WillysK5; 05-21-2009 at 05:39 PM.

  4. #4
    Registered User
    Join Date
    05-20-2008
    MS-Off Ver
    2003 suite
    Posts
    64

    Re: How to hide '0' shown in empty fields (Access form)

    Eh, I'm getting compile errors. "Method or data member not found." And it's highlighting
    Code:
    .FieldName

  5. #5
    Registered User
    Join Date
    05-20-2008
    MS-Off Ver
    2003 suite
    Posts
    64

    Re: How to hide '0' shown in empty fields (Access form)

    I found it. Back in the table the default value was '0'. I just deleted that and it's fine.

    Sheesh...anyone smell n00b?

    Thanks!

  6. #6
    Valued Forum Contributor
    Join Date
    04-23-2009
    Location
    IOWA
    MS-Off Ver
    2010 Professional
    Posts
    233

    Re: How to hide '0' shown in empty fields (Access form)

    Np glad I could help.

    ".Fieldname" needed to be replaced with the name of the field you were trying not to show 0 in.

    Dan
    "I am not a rocket scientist, I am a nuclear engineer." - Split_atom18
    If my advice has been helpful to you, then please help me by clicking on the scales and adding to my reputation, Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0