Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

MS Access - Form_Load and SubForm issue

  • 20-01-2009 2:17pm
    #1
    Registered Users, Registered Users 2 Posts: 2,598 ✭✭✭


    Having a bit of trouble with an MS Access form and a subform running off a query so any help would be appreciated.

    Deal is:
    Form displays a textbox with a reference number in it.

    Subform source is a query, with the WHERE clause criteria based on the reference number on the main form.

    Reference Number is set on Form_Load, Current and Activate events.

    When I open the main form directly there is no problem however when I open it from another form,
    the subform seems to trigger before the main Form_Load gets to set the Reference.
    So it displays an InputBox to get the value before the form_Load actually populates it.

    (Not sure if all that makes sence!?!)
    Any ideas?


Comments

  • Moderators Posts: 51,922 ✭✭✭✭Delirium


    Could you not populate the value into a global variable. That way you could set the subform WHERE clause to use a function that returns the variable.

    Example
    Global gblIDProduct AS Integer
    
    Function GetGblIDProduct()
      GetGblIDProduct = gblIDProduct
    End Function
    

    Then the WHERE Clause could use the following syntax
    SELECT tblProduct.* FROM tblProduct
    WHERE idProduct = GetGblIDProduct()
    

    Hope that helps:)

    If you can read this, you're too close!



Advertisement