Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Variable not defined Form.Name (Access 2000)

    I'm having a problem in compiling a new database I'm writing. I've imported quite a bit of working code from other databases, but code that is working elsewhere is causing an error - Variable not defined - with the highlight on the word Form within this line

    Call MsgError(Err.Number, Err.Source, Err.Description, Form.Name, "AzSelectReset")

    I assumed at first that this must be a problem with references although I'm not at all certain which library holds the From variable. My references appear to be identical to those set in the other database, and are:

    VBA, VBA Extensibility 5.3, Access 9, OLE Automation, ADO 2.1, DAO 3.6, Word 9

    I note that I have more than 4 entries called VBA in the list of possible references and I wonder if the wrong one has been selected, although this seems to be an automatic selection. Unfortunately I can't read the actual file name as its name extends beyond the dialog box. I can read C:Program FilesCommon FilesMicrosoft SharedVBAVBA6 and that is all.

    My question: which reference do I need for the Form variable? If VBA, what is the file name of the library I should be referencing?

    David

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Variable not defined Form.Name (Access 2000)

    I think you have copy the code form a form module.
    Form.Name in a form module will render the name of the form.
    If you are using this code in a general module just remove Form.Name as it has no sense.
    Francois

  3. #3
    3 Star Lounger
    Join Date
    Jun 2002
    Location
    Nottingham, Nottinghamshire, United Kingdom
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Variable not defined Form.Name (Access 2000)

    The procedure MsgError is in a general module and can be called from forms, reports or other general modules using

    Call MsgError(Err.Number, Err.Source, Err.Description, Form.Name, "Some text")

    In this particular situation the Call is being made from a procedure within a general module and I understand now that I should take Form.Name out and replace it with a string. What I still don't understand is why general modules that work perfectly OK in one database have problems in another. However I think I have rather more serious problems as when I comment out the offending lines I'm getting Variable errors with query names. I think there's some corruption and I'll deal with this and post again if the problem reoccurs.

    Thanks
    David

Posting Permissions

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