Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    outside procedure (Access 2000)

    I want to place some variable at the beginning of the form above all the other functions and events but i am told
    by Acces that i am trying an outside procedure. How can i declare the variables to be valid for all the functions in the form?

    Dim BuildingSite As Control
    Set BuildinSite = Parent!Lawns

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

    Re: outside procedure (Access 2000)

    You can declare a variable (Dim ... As ...) at the top of a module, before all procedures (subs) and functions, but you cannot assign a value there. You can only assign a value to a variable in a procedure or function. You could set the value of the variable in the On Load event of the form.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: outside procedure (Access 2000)

    Thank you. I have done what you recommended and have put the variable in ht eOnLoad event. When i oepne the database fo the frist time, in the afterupdate event i get the message " object variable not set".
    When i close the database and open it again, everything runs well, no error appears and i have no problems.I want to avoid this error atthe start of the database.What command shall i use to prevent it ?

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

    Re: outside procedure (Access 2000)

    Not knowing what code you have, it is impossible to give advice.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: outside procedure (Access 2000)

    Would he need to put it in the OnOpen event of the form especially if Lawn is a bound control?

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

    Re: outside procedure (Access 2000)

    It's worth a try.

Posting Permissions

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