Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2005
    Thanked 0 Times in 0 Posts

    Invalid commands (Access 2000)

    In the following code neither the command Me!heading.Caption = "Trivia" nor the requeries Me!List4.Requery or Me.requery work.The error says that there is not such an object

    DeleteTables , this is a function
    Dim db As DAO.Database
    Dim ws As DAO.Workspace
    Dim rst As DAO.Recordset
    Set ws = DBEngine.Workspaces(0)
    Set db = ws.OpenDatabase(bappath, False, False, "MS Access;PWD=secret")
    LinkTables (bappath), this is a function
    DoCmd.Close acForm, Me.Name
    DoCmd.OpenForm " frmDemo"
    Me!heading.Caption = "Trivia"

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Invalid commands (Access 2000)

    Me refers to the form (or report) that contains the module with the code. So for this code to be valid, it must belong to a code with a control named List4 and a control named Heading. The statement

    Me!heading.Caption = "Trivia"

    makes no sense since 2 lines higher up, you have closed the form

    DoCmd.OpenForm acForm, Me.Name

    Once you have closed the form, there is no point in setting the caption of a control on that 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