View Full Version : can not quit access properly


adaniele
05-01-2007, 07:40 PM
Hi all, thx 4 your time and hlp in advance.

Info:
I migrated a database from access 97 to xp. Everytingh worked perfect in 97.

Situation:
There is a login form. Once the user is logged in the login form is hidden and the main menu comes up. Here is the code for this action:
If Me.username1.Value = "Mdaniel" Or Me.username1.Value = "Admin" Then
Form.Visible = False
For i = 1 To CommandBars.Count
CommandBars(i).Enabled = True
Next i
DoCmd.SelectObject acTable, , True
stDocName = "supermenu"
DoCmd.OpenForm stDocName, , , stLinkCriteria
If Me.username1.Value = "Admin" Then
vmac = Environ("username")
DoCmd.SetWarnings False
DoCmd.RunSQL ("insert into adminlog (mac,modon) values ('" & vmac & "','" & Now() & "');")
DoCmd.SetWarnings True
End If
Else
Form.Visible = False
stDocName = "supermenu"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
There is an option in the main menu which is EXIT. The code for this option is:
docmd.quit

Problem:
for some reason when the user is not the admin or mdaniel, an error msg appears saying that the login form can not be found. However this form is still hidden.

any clue?
thx, max.

adaniele
05-07-2007, 02:52 PM
workround...
I make the database windows visible for all users and now the problem is gone.

The disadvantage is now they see the database window but they cant use it because i am using popup and modal YES.

Could somebody let me know , why it was working properly in access 97 and now i had to do this for access xp?

thx, max.

RuralGuy
05-07-2007, 03:23 PM
Have you tried changing Form.Visible = False to Me.Visible = False?

adaniele
05-10-2007, 04:38 PM
ruralguy, mate!!!!!!!!! u are a geniuos....

thx very much. max.

RuralGuy
05-10-2007, 05:17 PM
Nope...just took my best guess, but you are very welcome. Thanks for posting back with your success.