Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    May 2002
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Opening forms automatically...

    Hi again! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    I have a question... I know I have seen this before, but I don't know how to make it happen... <img src=/S/doh.gif border=0 alt=doh width=15 height=15> ...How do you make a form open (preferably maximized?) as soon as the user opens the .mdb file? ... I have a form that I made as an interface ... I don't want the user seeing the Database Window, and then having to open up the form from the Forms tab... I'd like the form to open and then everything the user needs to do with this application is on buttons, etc. on that form...

    I just had a thought!... It would also be wonderful if when they closed the form, it closed the database file automatically...

    Any ideas would be greatly appreciated!!
    TIA!

    P.S. I'm using Access '97

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    La Verne, California, USA
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening forms automatically...

    Create a macro that does all of what you want: open the form; hide the database window; and on the form create a command button that performs the exit database function. The name this macro AUTOEXEC and whatever is in it will fire automatically whenever the database opens.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening forms automatically...

    Simplest way would be go to Tools | Startup... There you can set the initial form, turn off the database window, block the "special keys" (e.g. F11 to display the database window), and a few other things.

    Note that the user can circumvent this by holding down the shift key when starting the database (that will also prevent an autoexec macro from executing). If you're trying to use this for security, you'll need to block the shift key (the code for that has been posted a few times recently).

    The most reliable way of ensuring that the database goes away when the form closes would be to stick Application.Quit in the code for the Close event of the form.

  4. #4
    Lounger
    Join Date
    May 2002
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening forms automatically...

    Boy Preston!! You are good!!! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> Thanks!

    I had searched around in another database file that was working as I wanted this one... and was looking for the way they made it work... but I had no idea it would be the NAME of the macro! lol... I had seen the AUTOEXEC name...but just thought that was just a name that made sense... That's cool!!! Thank you so much! [img]/forums/images/smilies/smile.gif[/img]

    I just tried it and it works PERFECTLY!! ...That was so quick!

    I hate to ask silly questions...but I can only imagine the amount of time I would have wasted trying to figure this out on my own!!!

    Have a great day! <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

  5. #5
    Lounger
    Join Date
    May 2002
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening forms automatically...

    Thanks Douglas! I will definitely do that for the main application!... I need all the help I can get as far as Securing the database files... <img src=/S/smile.gif border=0 alt=smile width=15 height=15> I am leaving this position in a month and I am so afraid something will happen to the three applications I have created for them... They have been running soooo smoothly!! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>

    Thanks again!

  6. #6
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Tennessee
    Posts
    194
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Opening forms automatically...

    if you want to close the database from the form you can put this code behind a button
    DoCmd.Quit
    and it will close the database for you
    hth
    JerryC

Posting Permissions

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