Results 1 to 6 of 6
  1. #1
    raton is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2012
    Posts
    22

    visible a cmd button if subform show any record


    a search form with a subform
    if subform got a record by the search then a cmd button will me visible
    how can i do it

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    In the event that does the search, something like:

    If Not IsNull(Me.subformname!fieldname) Then Me.commandbuttonname.Visible = True

    or

    Me.commandbuttonname.Visible = Not IsNull(Me.subformname!fieldname)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    raton is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2012
    Posts
    22
    this code is not working

    problem
    a main unboubd form with a subform(subform is made by a query. query has 5 field, namefield criteria is forms!mainform!textboxname )
    a unbound textbox in the main form and a search button.
    type a name in the textbox and click the search button
    which requery the subform and show the result

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What isn't working - the search or setting visibility? What happens - error message, wrong results, nothing?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    raton is offline Novice
    Windows 7 64bit Access 2003
    Join Date
    Feb 2012
    Posts
    22
    Private Sub cmdgo_Click()
    Me.Qservice_subform.Requery
    If Not IsNull(Me.Qservice_subform!Cname) Then
    Me.cmdpay.Visible = True
    Else
    Me.cmdpay.Visible = False
    End If
    End Sub

    visibility is working but the else condition is not working, i want it invisible if the condition is not met

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Step debug. What happens when you expect the referenced field is null? Does the False line get executed?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 8
    Last Post: 11-08-2011, 05:11 AM
  2. Replies: 1
    Last Post: 06-08-2011, 07:30 AM
  3. Replies: 2
    Last Post: 01-06-2011, 04:38 AM
  4. Replies: 10
    Last Post: 12-31-2010, 12:35 PM
  5. Replies: 4
    Last Post: 10-29-2008, 11:53 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