Results 1 to 4 of 4
  1. #1
    panoss is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Oct 2014
    Posts
    59

    Form fields are null in the onLoad (or onOpen) event?

    I have a form and in it two date fields and a subform.


    I want want I open the form the subform's data to be between ta dates of the two datefields.
    But when the form Opens or Loads (I tried both onLoad and onOpen events of the form) the two date fields are null (I guess they are created later).
    After the form opens, I can use the two date field to filter the subform with a button.
    The problem is on the form's open or load.
    What can I do about this?

    Edit: I also tried onCurrent event, but no success too, it's the same as the other two events.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The two date fields are populated how? These are unbound controls to enter filter criteria?

    You should know that subforms load before the main form - I know sounds backwards but it is the way it is.

    Why are you using form/subform arrangement? Is the main form bound to data? If not, then use the subform independently. Continuous View can be made to look like Datasheet and this will make the form header available so the date controls can be positioned there. Can set their DefaultValue property to some date values that will encompass all records.
    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
    panoss is offline Advanced Beginner
    Windows 7 32bit Access 2003
    Join Date
    Oct 2014
    Posts
    59
    Quote Originally Posted by June7 View Post
    The two date fields are populated how? These are unbound controls to enter filter criteria?
    They are bound to a table. I did it this way, so that they are saved.
    So when the user opens the form, the last dates entered, are shown.
    Quote Originally Posted by June7 View Post
    You should know that subforms load before the main form - I know sounds backwards but it is the way it is.
    I tried both in the subform's and form's events.

    Why are you using form/subform arrangement? Is the main form bound to data? If not, then use the subform independently. Continuous View can be made to look like Datasheet and this will make the form header available so the date controls can be positioned there. Can set their DefaultValue property to some date values that will encompass all records.[/QUOTE]
    The main form in fact has the dates table as datasource.
    I don't think the problem is that they are positioned on different forms (I mean the date fields and the subform).

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The subform loads before the main form, so even if the textboxes have dates in them the subform would not be able to filter because the textboxes are not available to the subform when it loads. Although setting the subform container Master/Child Links somehow deals with this and synchronizes the two datasets. But you are not using Master/Child Links.

    What method are you using to filter the subform?

    If the textboxes are blank when the form opens then it is opening to a new record row?
    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. AllowDeletion Property on OnOpen event
    By excellenthelp in forum Access
    Replies: 2
    Last Post: 11-18-2014, 08:31 AM
  2. Replies: 2
    Last Post: 04-03-2014, 11:44 AM
  3. Onload event doesn't work for filter
    By tagteam in forum Forms
    Replies: 2
    Last Post: 02-12-2014, 11:54 AM
  4. Replies: 2
    Last Post: 01-22-2013, 10:39 PM
  5. Record Check on Form OnLoad
    By tramp82 in forum Forms
    Replies: 10
    Last Post: 10-19-2011, 07: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