Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004

    Unanswered: Change the sub formís record source

    I have a main form that has 6 sub forms
    Each sub form's record source is link to a different Query

    It take more then a minute to open the form,

    The first option would be to remove the sub forms record source, and replace it with
    SELECT * FROM tblState WHERE False
    Then I will add to each retrieve button something like this
    Me.SubSearchByBPI.Form.RecordSource = "select * from qFindAll_FilterBP"

    I tested it and do not get the ďnameĒ ďerrorĒ

    All the queries are based on a single union query
    the union query has a filter where one filed is pointing the main form

    The main form is a search form
    the main search form has 6 sub forms, every sub form is a different type of search, and will show deferent fields (There is no need to update data)

    For searching by book and page, you can use County = NewLonden Book = D11417

    This attached file is setup as the original way

    Pease pay attention, that all searches are based on the County on the
    main form as well as the Doc type on the main form. However, the doc
    type is not required.

    Can any one please tell me what I can do in order to speed up the loading time?

    I appreciate your time and help
    Thank you
    Attached Files Attached Files

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    what you could do is in the sub forms on open event place some code which sets the sub forms recordsource to a recordset which returns no data

    assuming you were using an autonumber column

    eg select * from <mytable> where <myautonumbercolumn>=0

    then when the data in the parent form changes (the parent forms 'on current event' set the subforms record sources to the appropriate where clause

    eg select * from <mytable> where <myautonumbercolumn>= 99095

    if you are experiencing delays, it would indicate that you may have a (multiple) query problem(s). The basic guideline is suck as little data accross the network as possible, populate queries with the required data only (ie where possible avoid using the select * (use Specify the required fields only) - as easy/convienient as it is it can have an adverse impact on query performance. Admittedly you will not see a great deal of benefit when using JET as your data store - but its a good practise to get into.

    Set the forms original data source to return no records (possibly using a filter which again returns no records).


  3. #3
    Join Date
    Nov 2004
    Actually Iím using
    SELECT * FROM tblState WHERE False

    Since it has a ďWHERE FalseĒ, it should take no time to load. Am I correct?

  4. #4
    Join Date
    Dec 2002
    Prťverenges, Switzerland
    a form/subform doesn't need a .recordsource at load - delete it

    doesn't need to be visible either

    if you have some default .recordsource you want to display, consider design-view setting the timer to "a suitable value" and in the form's _Timer() event

    me.timerinterval = 0
    'here set your default .recordsource

    the timer doesn't kick in until the form is fully loaded and displayed. your screen comes up and the user is gratified with the instant response. then set the .recordsource while the user is eyeballing your splendid GUI

    "a suitable value" depends on what your form has to do when loading. you might get away with 1 msec, but if you have combos to load etc etc etc you might need longer: try 5, 50, 500 etc until you get the desired effect

    downside: you can't use that form's timer for anything else without a bit more code in _Timer() to see if this is a newly loaded form or some other timer event.

    currently using SS 2008R2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts