Results 1 to 4 of 4
  1. #1
    euphonium01 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    40

    Visible - Not Visible Macro Not Working?

    I have a Subform (called OrderDetails) on a Page Tab (called Orders) that links to the Customer, the relevant data in the subform changes as I click through the Customer records no problem, I also have a Button on the same Page Tab (called 'Link') to open another form. What I want is for the 'Link' button to be not visible of the 'Subform!OrderID' control is Null. I created a Macro and attached it to the OnCurrent property of the main form:

    If IsNull([OrderDetails].Form![OrderID])
    SetProperty


    Link
    Visible
    No
    End If

    If Not IsNull([OrderDetails].Form![OrderID])
    SetProperty
    Link
    Visible
    Yes


    There's something wrong as the button is always visible, can anyone tell me why? Do I have to refer to the Page Tab (Orders) as well as the Subform (OrderDetails) for instance? I've used the IsNull/Not IsNull and referred to Subforms before without any problems? If it has to be done in vb, then I do have a problem, as I simply can't get anything to work!

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    btn.visible =not isNull( [OrderDetails].Form![OrderID])

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    'Subform!OrderID' control is Null
    is this because this is a new record? if so, use the newrecord property. I don't use macros but in vba it would be

    link.visible=not me.newrecord

    and would be called in the form current event

  4. #4
    euphonium01 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Posts
    40
    Hi, and thanks for your messages back, your help resolved the problem I had. I really need to get to grips with vba, when I see the correct code it appears obvious but not easy to learn!

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

Similar Threads

  1. Replies: 16
    Last Post: 03-26-2015, 08:35 PM
  2. Replies: 4
    Last Post: 11-04-2014, 07:35 PM
  3. Replies: 30
    Last Post: 07-21-2014, 02:46 PM
  4. Visible/Not Visible based on condition VBA
    By BLFOSTER in forum Programming
    Replies: 3
    Last Post: 07-15-2014, 01:29 PM
  5. Replies: 2
    Last Post: 01-06-2011, 04:38 AM

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