Results 1 to 7 of 7
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    If Statement Criteria Needed for form

    1. checkbox named Check1 'NO code for this
    2. command button named OK 'Used to close form Startup, rename autoexec macro to autoexecx
    3. form name is Startup
    4. command button named command12 'Closes Database
    5. macro autoexec opens form Startup
    _______________________________________
    4. Command12 uses DoCmd.Quit ' Close Database

    This is NOT working for me.Must be a better,simple way.
    ____________________________________________


    So, my question is, after reading information on form, user agrees to terms by checking Check1 (checkbox) then click on OK
    and macro is renamed from autoexec to autoexecx then form closes.
    If not, user can click on command12 (commandbutton) then it closes database.

    I want them to read the form information First.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    So this is CYA procedure like the 'I Accept' option when installing new software? I never read that license agreement - LOL!

    Why is not working - error message, wrong results, nothing happens?

    Why rename autoexec?

    Need code (or db) to analyse.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    No errors, it just does not close the form when clicking on the OK command button.
    The command12 button works though.
    If I dont rename autoexec, the form will load again because autoexec loads the form Startup

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    As stated, need code to analyse.

    I don't use macros, think they are harder to debug.

    Maybe this will help http://support.microsoft.com/kb/89610
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Private Sub Command12_Click()
    DoCmd.Quit

    End Sub

    Private Sub Form_Current()
    If Me!Check1 = False Then ' User Must Check This Box Or Else Close Database
    MsgBox "You Must Agree To Terms Or Else Not Use The Database"
    Else
    If Me!Check1 = True Then
    Forms!Startup!OK.SetFocus ' click OK, then form closes and does not appear again.
    End If
    End If
    End Sub

    Private Sub OK_Click()
    If Me!Check1 = True Then
    DoCmd.RunMacro ("RemoveStartup") ' rename autoexec to autoexecx
    DoCmd.Close acForm, Me.Name ' close form Startup
    End If
    End Sub

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Is the OK button Click event property set to [Event Procedure]?

    Place a breakpoint on the If line in the OK event - does the code execute?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2002
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Man, I am really good! It is fixed somehow, maybe somebody sneaked in and felt sorry for me. It worked like a charm. BTW, Yes, I am using this as a simple way to ask the user if they accept the terms and conditions of using the database. My db opens to the main form as always and I use a File/Menu System just like windows does instead of a Switchboard of which I am not a fan.So I had 2 forms opening, one being called thru the Tools/Startup and another thru the autoexec macro.

    Thanks June7,

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 03-21-2012, 12:51 PM
  2. Iif statement with multiple criteria
    By coach32 in forum Queries
    Replies: 1
    Last Post: 09-07-2011, 01:28 AM
  3. Query Criteria help needed
    By iuianj07 in forum Queries
    Replies: 1
    Last Post: 01-21-2011, 02:57 PM
  4. Passing Criteria to IN statement from Form
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-09-2009, 04:02 AM
  5. Replies: 0
    Last Post: 01-01-2007, 02:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums