Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2000 Close Start Form if checked "Yes"

Posted on 2002-04-02
3
Medium Priority
?
201 Views
Last Modified: 2011-09-20
Access 2000

I have a startup disclaimer form with two option check boxes: 1 = Agree, 2 = Disagree

- Table Name: tblNoticeDisclaimer
- Field Name: Agree
- Data Type: Number
- Form Name: frmNoticeDisclaimer

and then I have a main menu form "frmMenu"

I wish the disclaimer form to open first "Not a problem", then if the user has already viewed the disclaimer, and checked the box as "Accepted" (option value 1) open the main menu form, and never show the disclaimer form again when the database is being opened.

However, if the user checks the "Do Not Accept" (option value 2) box, then close the database, and keep it closed. i.e. if the user tries to open the database again, it opens sees that the "Do Not Accpted" option has been checked then closes.

Guidance Welcome :-)

0
Comment
Question by:DWB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
Dan_Morris earned 200 total points
ID: 6913093
Use an autoexec macro to run some code that will open your disclaimer form if field: Agree is null

open your menu if Agree is True

of close your database if Agree is false

Public Function CheckDisclaimer()

  dim var as variant

  var = DLookup("Agree", "tblNoticeDisclaimer")

  Select Case var
     Case Null
        docmd.openform "frmNoticeDisclaimer"
     Case 1
        docmd.openform "frmMenu"
     Case 2
        'add timer code to "frmNoticeDisclaimer" to close itself after a few seconds
        docmd.openform "frmNoticeDisclaimer", View:=acNormal, WindowMode:=acDialog
        docmd.quit
  End select
End Function


Add a function similar to this to a module.  Create a macro named autoexec and select run code, specify the name of the function/sub to run.

Note: this does however fall prey to the shift-key bypass that Access has when opening.

Hope this helps,

Dan
0
 
LVL 54

Expert Comment

by:nico5038
ID: 6913448
I guess your disclaimer is linked to a table.
In the autoexec you test for the Option to be "Agree" and skip the form.
In the other case however ( "Disagree" or empty) you should just show the form and not issue a Close of the database...

Nic;o)
0
 

Author Comment

by:DWB
ID: 6913766
Thank you very much for your responses!  

Sorry for the delay, however I normally receive a response via email, and for some reason that did not happen this time, regardless, all well, that ends well.

Dan, I've used your option, and it appears to work well; thank you!

nico5038, I like your idea about just re-showing the form vice closing the database, thanks!

Another happy customer served :-)

Cheers

Dave
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question