• Run Macro On Open? (Office XP)

    Author
    Topic
    #413043

    How do I make a macro run upon opening my database? I want (upon open) my WelcomeForm to open.

    Viewing 1 reply thread
    Author
    Replies
    • #908197

      You don’t need a macro for that. Select Tools | Startup… In the Startup dialog, you can specify which form (if any) will be displayed when the database is opened, whether the database window will be visible etc.

      Notes:
      – You can bypass these options by keeping the Shift key down while opening the database.
      – You can disable the Shift key as bypass key, see for example post 181926.
      – If you want to use a macro instead, name it AutoExec. It will be executed automatically when the database is opened.
      – Again, running AutoExec can be prevented by keeping Shift down, unless this has been disabled.

      • #908207

        Awesome…thanks! I’m a little confused right now. How do I set a user group so it is unable to view the database window, but able to edit information I select?

        • #908213

          I’m confused too. What exactly do you mean? Are you speaking about user-level security?

          • #908224

            Well yes, I have my admin user level set, but 1) how do i create more? Also – I have two tables, my main table (Table 1), and another one (Table 2), both have ssn. I want to allow multiple occurrances of SSN in Table 2, as Table 2 will contain recurring events (scores from competitions…) how do I have to set that up? I’m trying to set up a form where all that is entered is SSN, date, and score (assuming that will create a new record), and then I can create a report saying who hasn’t competed, as well as all previous competition scores. I’d also like to export that info as excel, so I don’t have to PRINT the grouped report….

            • #908230

              That’s a lot of questions in a few lines!

              – You really should study the documents referred to in post 432371. The first link in WendellB’s tutorial, ACC2000: Microsoft Access Security FAQ Available in Download Center is very useful, it explains a lot of details about setting up security.

              – You want a one-to-many relationship between Table1 and Table2 on the SSN field. This implies that SSN is the primary key in Table1, but not in Table2. To learn more about the types of relationships between tables, study a good book about database design (for example Access Database Design and Programming by Steven Roman). In the meantime, you can download a short paper by Microsoft from “Understanding Relational Database Design” document is available in Download Center.

              – You can export tables, queries, … to Excel.

            • #908239

              A lot of the security I’ve figured out….I just realized I needed the One – To – Many relationship, but forgot that I’d set the SSN as the primary key in Table 2. My primary key is only in table 1, but when i try to enter a ssn again in the form to add another instance, it won’t let me….

            • #908241

              What is the Record Source of the form? What is the exact error message you get?

            • #908249

              -Edit- I GOT IT!!! Ok, done with the victory dance, thanks for the help Hans!

            • #908255

              If you figured it out, the generous thing to do is to post the solution so that others can benefit from it. Please share it with us.

            • #908364

              Yikes! Sorry, it was a simple error though….all I was doing was using the wrong linked field in my form….I needed to use the linked field from my secondary table, the one I want to allow multiple occurrances in.

            • #908365

              Yikes! Sorry, it was a simple error though….all I was doing was using the wrong linked field in my form….I needed to use the linked field from my secondary table, the one I want to allow multiple occurrances in.

            • #908256

              If you figured it out, the generous thing to do is to post the solution so that others can benefit from it. Please share it with us.

            • #908250

              -Edit- I GOT IT!!! Ok, done with the victory dance, thanks for the help Hans!

            • #908242

              What is the Record Source of the form? What is the exact error message you get?

            • #908240

              A lot of the security I’ve figured out….I just realized I needed the One – To – Many relationship, but forgot that I’d set the SSN as the primary key in Table 2. My primary key is only in table 1, but when i try to enter a ssn again in the form to add another instance, it won’t let me….

            • #908231

              That’s a lot of questions in a few lines!

              – You really should study the documents referred to in post 432371. The first link in WendellB’s tutorial, ACC2000: Microsoft Access Security FAQ Available in Download Center is very useful, it explains a lot of details about setting up security.

              – You want a one-to-many relationship between Table1 and Table2 on the SSN field. This implies that SSN is the primary key in Table1, but not in Table2. To learn more about the types of relationships between tables, study a good book about database design (for example Access Database Design and Programming by Steven Roman). In the meantime, you can download a short paper by Microsoft from “Understanding Relational Database Design” document is available in Download Center.

              – You can export tables, queries, … to Excel.

          • #908225

            Well yes, I have my admin user level set, but 1) how do i create more? Also – I have two tables, my main table (Table 1), and another one (Table 2), both have ssn. I want to allow multiple occurrances of SSN in Table 2, as Table 2 will contain recurring events (scores from competitions…) how do I have to set that up? I’m trying to set up a form where all that is entered is SSN, date, and score (assuming that will create a new record), and then I can create a report saying who hasn’t competed, as well as all previous competition scores. I’d also like to export that info as excel, so I don’t have to PRINT the grouped report….

        • #908214

          I’m confused too. What exactly do you mean? Are you speaking about user-level security?

      • #908208

        Awesome…thanks! I’m a little confused right now. How do I set a user group so it is unable to view the database window, but able to edit information I select?

    • #908198

      You don’t need a macro for that. Select Tools | Startup… In the Startup dialog, you can specify which form (if any) will be displayed when the database is opened, whether the database window will be visible etc.

      Notes:
      – You can bypass these options by keeping the Shift key down while opening the database.
      – You can disable the Shift key as bypass key, see for example post 181926.
      – If you want to use a macro instead, name it AutoExec. It will be executed automatically when the database is opened.
      – Again, running AutoExec can be prevented by keeping Shift down, unless this has been disabled.

    Viewing 1 reply thread
    Reply To: Run Macro On Open? (Office XP)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: