Results 1 to 6 of 6
  1. #1
    andrejamih is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    15

    Preventing entering data suboforms' fields until Master Field is filled?


    I have main form and tab control with few subforms. I have set parental control with master field and child field. The field is W/O-Number. What would be the VBA code for preventing adding data into subofrms' fields without filling Master field on main form?

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    If you set the sub form properties to filter on no data, I believe it will hide the subform contents.
    Subform.FilterOnEmptyMaster


  3. #3
    andrejamih is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    15
    Thanks man, but it doesn't help me to solve problem of saving subforms' data into a child table. I want to prevent adding any entering data in subforms' fields until the master field in main form is filled.

  4. #4
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Don't enable the subform until your main form record is no longer new? Something like

    Me.YourSubformContainer.Enabled = Not Me.Newrecord

  5. #5
    andrejamih is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    15
    Yes, thank you, but how to get the smooth requery of the tabbed control and permanently to change behavior (When I click on button NEW RECORD, I want the tab control to "frozen" fields... And when I fill master field W/O-Number, the tab control appear unlock "unfrozen"?

  6. #6
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    There are a host of ways - but probably the simplest would be to save your top level record as soon as the first field is completed, then enable the sub form. So the process would be something along the lines of

    New Record Button Click¬
    Lock the subform tab page ¬
    User enters first bit of data on master record¬ ( you could force this by setting focus to it and disabling all other controls? )
    after update me.dirty - false ¬ (to save record )
    unlock tab pages - (as you now have a master record.)

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

Similar Threads

  1. Replies: 2
    Last Post: 03-31-2017, 08:40 AM
  2. Replies: 7
    Last Post: 12-09-2014, 03:06 PM
  3. Replies: 3
    Last Post: 11-24-2013, 06:59 PM
  4. Replies: 3
    Last Post: 12-11-2011, 02:18 PM
  5. Replies: 2
    Last Post: 03-16-2009, 12:19 PM

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