Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    When does a form filter become active (2003)

    I have some code in the Load event of a form that creates an SQL string that creates a table. The code uses a field called AllocID to filter the rows that will be added to the new table. The AllocID is used in the Where string that opens the form (e.g. "[AllocID] = '02411_IR' AND SummaryStatus = 'A'") which is visible in the form's filter from within the Load event. I was expecting the current record to be one with an AllocID as defined in the filter but when I create the where clause part of the SQL string the AllocID is Null. Does the filter get applied to the form after the Load event?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: When does a form filter become active (2003)

    You can pass the AllocID in the OpenArgs argument of DoCmd.OpenForm; you can then use Me.OpenArgs in the On Open or On Load event of the form.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: When does a form filter become active (2003)

    Hi Hans,

    I had thought of that but my question was aiming at a more fundamental level. I often put a lot of code in the onLoad event of a form and up until now I have made reference to the values of bound controls in that code. Normally this has worked but I wonder if I have just been lucky with the timing.

    Regards
    Ian

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: When does a form filter become active (2003)

    In general, the value of bound controls should be available to the On Load event. Could it be that there are no records satisfying the WhereCondition (Filter)?

Posting Permissions

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