Results 1 to 2 of 2

Thread: Access Modules

  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access Modules

    I have two forms - MainForm and SearchForm. The MainForm has a number of controls and two subforms. 1 control is a combo box and another is a command button that linkls to the SearchForm. On the SearchForm there is a command button to return to the MainForm, hopefully with a record to display. What i am trying to do is get the MainForm combobox_afterupdate code to run but i do not know how to reference it as it is in the MainForm Class Module and the commandbutton that is being clicked is in the SearchForm Class Module. What syntax do i need please ?

  2. #2
    New Lounger
    Join Date
    Jul 2003
    Location
    Manhattan, Kansas, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access Modules

    A couple of ways to do this:
    1) Make the afterupdate sub Public instead of Private on the main form. To call it from the search form, use the following syntax: Forms!MainForm.combobox_AfterUpdate
    This works but is not really preferred as control events should really be local to the form, and not global to the app.
    2) Create a public function in a seperate module that does the work. You can then call it from wherever you want, such as the AfterUpdate event for the combobox on the Main form, and the Click event for the command button on the Search form.

Posting Permissions

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