Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Location
    Boise, Idaho, USA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    'visible' on reports (2000)

    Okay, this is the most frustrating thing I've come across yet....
    I have a field on my report that I want to show if something is true
    These are the exact lines:
    If Me.DUCat = 12 Then
    Me.Count.Visible = True
    Else: Me.Count.Visible = False
    End If

    The problem is when I try to open the report I get the following message:
    "Invalid Qualifier" (highlighting .Count)

    I've got this exact same coding for 2 other text boxes and they work fine.
    All I'm attempting to do is add another box to this report.

    what in the heck is wrong here.....
    I'm just smart enough to know this should work - not smart enough to trouble shoot why it's not working this time.

    This is probably something very dumb - and I'm not having a good day - so kindness and patience is appreciated.
    (although that's all I've ever gotten from this group...)

    <img src=/S/bwaaah.gif border=0 alt=bwaaah width=123 height=15>

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

    Re: 'visible' on reports (2000)

    Hi Deb,

    Count is a reserved word in Access, so it probably balks at a control named Count. Try renaming it to for instance txtCount, and adapting the code accordingly:

    If Me.DUCat = 12 Then
    Me.txtCount.Visible = True
    Else
    Me.txtCount.Visible = False
    End If

    or even simpler

    Me.txtCount.Visible = (Me.DUCat = 12)

    HTH,
    Hans

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: 'visible' on reports (2000)

    Hi Deb,
    Hans is correct that you shouldn't use reserved words for your control names. You would probably find that changing the syntax to:
    Me![Count].Visible = False
    works, but you should still avoid it really.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 'visible' on reports (2000)

    For your code to work, use Me!Count instead of Me.Count. Since "Count" is a method/property for all kinds of objects, Access "thinks" you are trying to reference the method/property when you use the period ("Count" happens not to be a valid method/property for the "Me" object, hence the error). When you use the the exclamation point, it looks for the "Count" object in the "Me" collection (i.e., the field you are trying to reference). If you changed the name of your field to something like MyCount to remove this ambiguity, then either Me.MyCount or Me!MyCount would work.

    Also, you could shorten your code (sacrificing some readability) using the following:
    <font face="Georgia">
    Me!Count.Visible = (Me.DUCat = 12)
    </font face=georgia>
    Hope this helps.

  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Location
    Boise, Idaho, USA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 'visible' on reports (2000)

    Thank you all SO much ---
    I knew it was something dumb - I should have known about the reserved word - Count...
    I will change the name of my field and I will attempt to avoid using those names in the future..
    And, thanks for the coding shortcut - I am self-taught and I know there's lots of those I could use...
    This one will definitely be on my list.

Posting Permissions

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