@@ -34,6 +34,7 @@ Private Enum DbConnectionInfoErrorNumbers
3434 ERRNR_INACTIVE = vbObjectError + 3
3535End Enum
3636
37+ Private Const m_DefaultLoginFormName As String = "LoginForm"
3738Private m_LoginFormName As String
3839Private m_DbmsConfigFormName As String
3940
@@ -86,7 +87,7 @@ Private m_UseLoginForm As Boolean
8687Private m_SAVEPWD As Boolean
8788
8889#If CONFIG_USELOGINFORM = 1 Then
89- Private WithEvents m_LoginForm As Form_frmLogin
90+ Private WithEvents m_LoginForm As Form_LoginForm
9091Attribute m_LoginForm.VB_VarHelpID = -1
9192#End If
9293
@@ -341,10 +342,7 @@ Private Sub ReadDBMSprop(Optional ByVal withoutLoginForm As Boolean = False, Opt
341342 End If
342343
343344 'm_LoginForm über Property LoginForm zugänglich machen und im LoginForm selbst setzen:
344-
345- Set g_TempRef = Me
346- DoCmd.OpenForm m_LoginFormName, acNormal, , , acFormEdit, acDialog, m_CID & "@" & LoginUserName
347- Set g_TempRef = Nothing
345+ DoCmd.OpenForm LoginFormName, acNormal, , , acFormEdit, acDialog, ObjPtr(Me) & "@" & m_CID & "@" & LoginUserName
348346#Else
349347 Err.Raise vbObjectError, "DbConnectionInfo" , "CONFIG_USELOGINFORM in Projekteigenschaften nicht gesetzt!"
350348#End If
@@ -405,7 +403,7 @@ Private Sub m_LoginForm_Logon(ByVal LoginName As String, ByVal Password As Strin
405403 m_DBUSER = LoginName
406404 m_DBUSERPWD = Password
407405
408- Call setConnectionStrings (False )
406+ Call SetConnectionStrings (False )
409407
410408 If CheckAdoConnection(m_OledbConnectionString, ErrMsg) = False Then
411409 If Len(ErrMsg) > 0 Then ErrMsg = vbNewLine & vbNewLine & ErrMsg
@@ -416,7 +414,7 @@ Private Sub m_LoginForm_Logon(ByVal LoginName As String, ByVal Password As Strin
416414 End If
417415
418416 If Len(m_DBUSER) > 0 Then
419- CurrentDb.Execute "UPDATE (select * from usys_DbmsConnectionWHERE DBMS='" & m_DBMSNAME & "') SET dbmsUser = '" & m_DBUSER & "'" ' thanks to MSFT (https://support.office.com/en-us/article/access-error-query-is-corrupt-fad205a5-9fd4-49f1-be83-f21636caedec)
417+ CurrentDb.Execute "UPDATE (select * from usys_DbmsConnection WHERE DBMS='" & m_DBMSNAME & "') SET dbmsUser = '" & m_DBUSER & "'" ' thanks to MSFT (https://support.office.com/en-us/article/access-error-query-is-corrupt-fad205a5-9fd4-49f1-be83-f21636caedec)
420418 SaveUserNameToConfigFile m_DBUSER
421419 End If
422420
@@ -426,7 +424,7 @@ Private Sub m_LoginForm_Logon(ByVal LoginName As String, ByVal Password As Strin
426424
427425End Sub
428426
429- Private Sub setConnectionStrings (Optional ByVal bWithConnectionCheck As Boolean = True )
427+ Private Sub SetConnectionStrings (Optional ByVal bWithConnectionCheck As Boolean = True )
430428
431429 Dim myConnectionStrings As DbmsConnectionStrings
432430 Dim ErrMsg As String
@@ -504,15 +502,15 @@ End Function
504502
505503Private Function CheckAdoConnection (ByVal sOleDbConnectionstring As String , ByRef Msg As String ) As Boolean
506504
507- Dim cnn As ADODB .Connection
505+ Dim cnn As Object ' ADODB.Connection
508506 Dim i As Long
509507
510508 If Len(sOleDbConnectionstring) = 0 Then
511509 CheckAdoConnection = False
512510 Exit Function
513511 End If
514512
515- Set cnn = New ADODB.Connection
513+ Set cnn = CreateObject( " ADODB.Connection" )
516514 With cnn
517515 .ConnectionString = sOleDbConnectionstring
518516 .ConnectionTimeout = m_CheckConnectionTimeout
@@ -587,7 +585,7 @@ End Function
587585Public Property Get OledbConnectionString() As String
588586
589587 If Len(m_OledbConnectionString) = 0 Then
590- setConnectionStrings
588+ SetConnectionStrings
591589 End If
592590 OledbConnectionString = m_OledbConnectionString
593591
@@ -609,7 +607,7 @@ End Property
609607Public Property Get OdbcConnectionString(Optional ByVal bWithoutUserInfo As Boolean = False ) As String
610608
611609 If Len(m_OdbcConnectionString) = 0 Then
612- setConnectionStrings
610+ SetConnectionStrings
613611 End If
614612 If bWithoutUserInfo Then
615613 OdbcConnectionString = Replace(m_OdbcConnectionString, getOdbcUserInfo(), "" )
@@ -634,7 +632,7 @@ End Property
634632Public Property Get DatabaseFile() As String
635633
636634 If Len(m_DatabaseFile) = 0 Then
637- setConnectionStrings
635+ SetConnectionStrings
638636 End If
639637 DatabaseFile = m_DatabaseFile
640638
@@ -653,11 +651,11 @@ End Property
653651' </remarks>
654652'**/
655653'---------------------------------------------------------------------------------------
656- Public Property Get DbUser(Optional ByVal withoutServerCheck As Boolean = False ) As String
654+ Public Property Get DbUser(Optional ByVal WithoutServerCheck As Boolean = False ) As String
657655
658- If Not withoutServerCheck Then
656+ If Not WithoutServerCheck Then
659657 If Not m_DbmsInfoReaded Then
660- setConnectionStrings
658+ SetConnectionStrings
661659 End If
662660 End If
663661
@@ -672,7 +670,7 @@ End Property
672670'---------------------------------------------------------------------------------------
673671' Property: DbUserPassword
674672'---------------------------------------------------------------------------------------
675- '/** 'nicht exportieren (2. * für Export fehlt)
673+ '/**
676674' <summary>
677675' Passwort des Datenbankbenutzers, das bei Anmeldung eingegeben wurde
678676' </summary>
@@ -682,10 +680,10 @@ End Property
682680' </remarks>
683681'**/
684682'---------------------------------------------------------------------------------------
685- Public Property Get DbUserPassword() As String
683+ Private Property Get DbUserPassword() As String
686684
687685 If Not m_DbmsInfoReaded Then
688- setConnectionStrings
686+ SetConnectionStrings
689687 End If
690688 DbUserPassword = m_DBUSERPWD
691689
@@ -706,7 +704,7 @@ End Property
706704Public Property Get SavePassword() As Boolean
707705
708706 If Not m_DbmsInfoReaded Then
709- setConnectionStrings
707+ SetConnectionStrings
710708 End If
711709 SavePassword = m_SAVEPWD
712710
@@ -727,7 +725,7 @@ End Property
727725Public Property Get UseLoginForm() As Boolean
728726
729727 If Not m_DbmsInfoReaded Then
730- setConnectionStrings
728+ SetConnectionStrings
731729 End If
732730 UseLoginForm = m_UseLoginForm
733731
@@ -838,7 +836,7 @@ Public Function ChangeDbUserPassword( _
838836
839837 If strLoginName = m_DBUSER Then
840838 m_DBUSERPWD = NewPassword
841- setConnectionStrings
839+ SetConnectionStrings
842840 RaiseEvent PasswordChanged
843841 End If
844842
@@ -1361,7 +1359,11 @@ End Property
13611359'**/
13621360'---------------------------------------------------------------------------------------
13631361Public Property Get LoginFormName() As String
1364- LoginFormName = m_LoginFormName
1362+ If Len(m_LoginFormName) = 0 Then
1363+ LoginFormName = m_DefaultLoginFormName
1364+ Else
1365+ LoginFormName = m_LoginFormName
1366+ End If
13651367End Property
13661368
13671369Public Property Let LoginFormName(ByVal NewValue As String )
0 commit comments