Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Window won't go away

Status
Not open for further replies.

DougAtAvalon

Programmer
Jan 29, 2001
99
0
0
US
my StartUp shows the Database Window is not supposed to come up (is not checked). It doesn't pop up, instead it brings up the Startup form i have selected. So, till this point all is ok. The form it brings up is basically a custom Dialog pop up that allows the user to loggin. After the user logs in the database brings up the DB window and then the switchboard.

Why is the DB window popping up and how can i prevent this from happening?

-Doug
 
Lets see the code that runs after your user logs in "The Key, The Whole Key, and Nothing But The Key, So Help Me Codd!"
 
First is in th OK button of the Loggin

Second is the hidden form that pops up and checks links. Maybe becaus eits hidden?

-Doug
-----------------------------------------------------
Private Sub BOK_Click()
On Error Resume Next

Dim y
Dim x
Dim vNewPassword
Dim vUserID As Long
Dim vPassword
On Error GoTo InvalidUserName
vUserID = DLookup("[UserID]", "SecurityUsers", "[UserName] = '" & Me.UserName & "'")
On Error GoTo InvalidPassword
vPassword = DLookup("[Password]", "SecurityUsers", "[UserID] = " & vUserID)
If vPassword <> Me.Password Or IsNull(Me.Password) Then GoSub InvalidPassword


If vPassword = &quot;Password&quot; Then
x = MsgBox(&quot;You still have the default password. Do you want to change the password now?&quot;, vbYesNo, &quot;CHANGE INFO&quot;)
If x = vbYes Then
DoCmd.Close
DoCmd.OpenForm &quot;SecurityChangeUserInfo&quot;, , , &quot;[SecurityUsers]![UserID] = &quot; & vUserID, , acDialog
Exit Sub
End If
End If

'Set Global Variables For Security

vCurrentUserID = vUserID
vCurrentUserName = Me.UserName
vCurrentPermission = DLookup(&quot;[Permissions]&quot;, &quot;SecurityUsers&quot;, &quot;[UserID] = &quot; & vUserID)
vCurrentGroup = DLookup(&quot;[Group]&quot;, &quot;SecurityUsers&quot;, &quot;[UserID] = &quot; & vUserID)
vSecurityOn = DLookup(&quot;[DefaultValue]&quot;, &quot;DefaultSettings&quot;, &quot;[DefaultID] = 'SecurityOn'&quot;)

RecordLoggin (vUserID)

DoCmd.Close
DoCmd.OpenForm &quot;frmCheckLink&quot;, , , , , acDialog
Exit Sub

-----------------------

Then in the frmCheckLink form this is a hidden form:

Private Sub Form_Open(Cancel As Integer)
vEmergencyClose = False
Dim y
Dim vRelink As Boolean
vRelink = False
' Tests a linked table for valid back-end.
On Error GoTo Err_Form_Open
Dim strTest As String, db As Database
Dim td As TableDef
Set db = CurrentDb
For Each td In db.TableDefs
If Len(td.Connect) > 0 Then ' Is a linked table.
On Error Resume Next ' Turn off error trap.
strTest = Dir(Mid(td.Connect, 11)) ' Check file name.
On Error GoTo Err_Form_Open ' Turn on error trap.
If Len(strTest) = 0 Then ' No matching file.
y = MsgBox(&quot;Couldn't find the back-end file &quot; & _
Mid(td.Connect, 11) & &quot;. Please choose new data file.&quot;, _
vbExclamation + vbOKCancel + vbDefaultButton1, _
&quot;Can't find backend data file.&quot;)
If y = vbOK Then
vRelink = True
If vCurrentPermission <> &quot;Database Administrator&quot; Or vCurrentGroup <> &quot;All Groups&quot; Then
y = MsgBox(&quot;Please tell your database administrator that your DATA FILE is incorrect.&quot;, vbOKOnly, &quot;INCORRECT DATAFILE&quot;)
Application.Quit
Exit Sub
End If
DoCmd.OpenForm &quot;frmNewDataFile&quot; ' Open prompt form.
Exit For
End If
If y = vbCancel Then
MsgBox &quot;The linked tables can't find their source. &quot; & _
&quot;Please log onto network and restart the application.&quot;
End If
End If
End If
Next ' Loop to next tabledef.
DoCmd.Close acForm, Me.Name
If vRelink = False Then DoCmd.OpenForm &quot;Switchboard&quot;
Exit_Form_Open:
Exit Sub
Err_Form_Open:
On Error Resume Next
MsgBox &quot;Oops! &quot; & Error.Description
Resume Exit_Form_Open
End Sub


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top