Results 1 to 2 of 2
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    If subform record count 0 Then..

    hi,

    I want make Label in subform visible, If subform's record count is zero. I don't know why It's not working. Here is my code :

    Code:
    Private Sub Command24_Click()
    
    
    If Me.MySubform.Form.Recordset.RecordCount = 0 Then
    'Msgbox "No records" - this is working
    
    
    Forms![MyForm]![MySubform].Form![Label23].Visible = True  - not working
    'Me![MySubform]![Label23].Visible = True  - this is also not working
    Else
    'MsgBox "There are records" - also working
    
    
    End If
    End Sub
    Am I referencing wrong, or what is the case here ?

  2. #2
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Sorry, figured out. Code is ok, just missing this (my subform was locked for addittions):

    Private Sub Command24_Click()


    If Me.MySubform.Form.Recordset.RecordCount = 0 Then

    Forms![MyForm]![MySubform].Form.AllowAdditions=True
    Forms![MyForm]![MySubform].Form![Label23].Visible = True

    End If

    End Sub

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

Similar Threads

  1. Updating Multiple Record Form Based on Record Count
    By William McKinley in forum Forms
    Replies: 2
    Last Post: 12-31-2014, 12:45 PM
  2. Count of records selected in a subform
    By snipe in forum Forms
    Replies: 6
    Last Post: 11-17-2014, 04:05 PM
  3. Replies: 8
    Last Post: 08-09-2013, 09:52 AM
  4. Subform record count warning message
    By FJM in forum Access
    Replies: 5
    Last Post: 01-29-2013, 08:17 AM
  5. Replies: 6
    Last Post: 08-22-2012, 03:24 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