Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Unanswered: running script at startup

    When the user starts up the Access 2k-application, temporary tables should be created on his local harddrive.

    I suppose I first have to create a database and then create the table.
    Instead of using the Docmd.runSQL - statement I want to run a script.
    How can I do this.

  2. #2
    Join Date
    Apr 2003
    Location
    Santa Barbara, CA
    Posts
    67

    Re: running script at startup

    Originally posted by artemide
    When the user starts up the Access 2k-application, temporary tables should be created on his local harddrive.

    I suppose I first have to create a database and then create the table.
    Instead of using the Docmd.runSQL - statement I want to run a script.
    How can I do this.
    This is interesting.

    You cannot run a function, script, or macro, to my knowledge, outside a form with Access. In VB you can but I don't know if you can create an Access Database.

    With in Access the only auto-launch is a Form. However, using On Load Event will launch a procedure. If you set echo False run your procedure and end with docmd.RunApp (The new Database) and docmd.quit No one would be the smarter.

    Let me know if you figure this out.

  3. #3
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: running script at startup

    Originally posted by Robt917
    This is interesting.

    You cannot run a function, script, or macro, to my knowledge, outside a form with Access. In VB you can but I don't know if you can create an Access Database.

    With in Access the only auto-launch is a Form. However, using On Load Event will launch a procedure. If you set echo False run your procedure and end with docmd.RunApp (The new Database) and docmd.quit No one would be the smarter.

    Let me know if you figure this out.

    How do I have to write a script in the first place.
    Can I just write it in Notepad for example.
    Is there a reserved extension for the file.
    Can you help me out with that?

  4. #4
    Join Date
    Apr 2003
    Location
    Santa Barbara, CA
    Posts
    67

    Re: running script at startup

    Originally posted by artemide
    How do I have to write a script in the first place.
    Can I just write it in Notepad for example.
    Is there a reserved extension for the file.
    Can you help me out with that?
    No, use the tools within Access.

    Create a Database with no tables.
    Create an unbound Form
    Within the On Load event write your new database.
    Set Toolstartupisplay Form/Page to the (form name)

    When you open the database it will create the scripted database.

  5. #5
    Join Date
    Oct 2001
    Location
    Chicago
    Posts
    440
    quote:
    --------------------------------------------------------------------------------
    Originally posted by Robt917
    This is interesting.

    You cannot run a function, script, or macro, to my knowledge, outside a form with Access. In VB you can but I don't know if you can create an Access Database.

    With in Access the only auto-launch is a Form. However, using On Load Event will launch a procedure. If you set echo False run your procedure and end with docmd.RunApp (The new Database) and docmd.quit No one would be the smarter.

    Let me know if you figure this out.
    --------------------------------------------------------------------------------

    Robt917- This is not correct - name your macro Autoexec and it will run at startup. You could then run any code from a function called by the macro.

    artemide - What are you trying to do? Please explain in detail.

    Matt

  6. #6
    Join Date
    Apr 2003
    Location
    Santa Barbara, CA
    Posts
    67
    Originally posted by Rockey

    Robt917- This is not correct - name your macro Autoexec and it will run at startup. You could then run any code from a function called by the macro.
    Matt
    I have done this with Excel but did not know that it could be done in Access.

    Robert

Posting Permissions

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