Results 1 to 2 of 2
  1. #1
    xwnoob is offline Advanced Beginner
    Windows Vista Access 2000
    Join Date
    Nov 2011

    How do i prevent sub-form add record button from enabling unless main form is dirtied

    Ok i have a form that has a subform which has a subsubform.

    I have this code right here in my sub form:
    Private Sub Form_Dirty(Cancel As Integer)
    'enable changes button
    Me!btnUndoIndividualBorrower.Enabled = True<====ignore this part!
    If Form_AddNewBorrower.Dirty Then
    Me!addnewrecordborrower.Enabled = True
    End If
    End Sub
    My main form name is AddNewBorrower.
    However it is not working. What I want to do is that once the main form is filled, then the add record button in the subform will be enabled. THis is because for some reason my subforms and subsubform enable the users to enter records without even entering information in the main form. I have linked the tables but i dont know why access still allows subform records to be entered without any main form info..So it would be best if the button only activates once user entered main form info

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    there is no inherent control/restriction of a subform because of the main form. it really isn't an Access issue per se.

    when I look at your enable code, I wonder if the object has been prior dis-enabled?

    To control the user - manipulating the visibility property is often the simplist approach, if feasible. Also consider a compare with Null or >0 of a field in the main form that must be populated - so that they can't go to the subform until there is a value there.

    hope it helps

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

Similar Threads

  1. Replies: 5
    Last Post: 11-11-2011, 11:06 AM
  2. Call a button on the main form from the subform
    By Grooz13 in forum Programming
    Replies: 1
    Last Post: 09-28-2011, 01:15 PM
  3. Replies: 9
    Last Post: 08-06-2011, 02:10 PM
  4. Replies: 0
    Last Post: 07-26-2010, 04:36 PM
  5. Replies: 6
    Last Post: 07-19-2010, 10:57 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 - Senior Forums