@@ -34,6 +34,7 @@ Private Enum DbConnectionInfoErrorNumbers
34
34
ERRNR_INACTIVE = vbObjectError + 3
35
35
End Enum
36
36
37
+ Private Const m_DefaultLoginFormName As String = "LoginForm"
37
38
Private m_LoginFormName As String
38
39
Private m_DbmsConfigFormName As String
39
40
@@ -86,7 +87,7 @@ Private m_UseLoginForm As Boolean
86
87
Private m_SAVEPWD As Boolean
87
88
88
89
#If CONFIG_USELOGINFORM = 1 Then
89
- Private WithEvents m_LoginForm As Form_frmLogin
90
+ Private WithEvents m_LoginForm As Form_LoginForm
90
91
Attribute m_LoginForm.VB_VarHelpID = -1
91
92
#End If
92
93
@@ -341,10 +342,7 @@ Private Sub ReadDBMSprop(Optional ByVal withoutLoginForm As Boolean = False, Opt
341
342
End If
342
343
343
344
'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
348
346
#Else
349
347
Err.Raise vbObjectError, "DbConnectionInfo" , "CONFIG_USELOGINFORM in Projekteigenschaften nicht gesetzt!"
350
348
#End If
@@ -405,7 +403,7 @@ Private Sub m_LoginForm_Logon(ByVal LoginName As String, ByVal Password As Strin
405
403
m_DBUSER = LoginName
406
404
m_DBUSERPWD = Password
407
405
408
- Call setConnectionStrings (False )
406
+ Call SetConnectionStrings (False )
409
407
410
408
If CheckAdoConnection(m_OledbConnectionString, ErrMsg) = False Then
411
409
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
416
414
End If
417
415
418
416
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)
420
418
SaveUserNameToConfigFile m_DBUSER
421
419
End If
422
420
@@ -426,7 +424,7 @@ Private Sub m_LoginForm_Logon(ByVal LoginName As String, ByVal Password As Strin
426
424
427
425
End Sub
428
426
429
- Private Sub setConnectionStrings (Optional ByVal bWithConnectionCheck As Boolean = True )
427
+ Private Sub SetConnectionStrings (Optional ByVal bWithConnectionCheck As Boolean = True )
430
428
431
429
Dim myConnectionStrings As DbmsConnectionStrings
432
430
Dim ErrMsg As String
@@ -504,15 +502,15 @@ End Function
504
502
505
503
Private Function CheckAdoConnection (ByVal sOleDbConnectionstring As String , ByRef Msg As String ) As Boolean
506
504
507
- Dim cnn As ADODB .Connection
505
+ Dim cnn As Object ' ADODB.Connection
508
506
Dim i As Long
509
507
510
508
If Len(sOleDbConnectionstring) = 0 Then
511
509
CheckAdoConnection = False
512
510
Exit Function
513
511
End If
514
512
515
- Set cnn = New ADODB.Connection
513
+ Set cnn = CreateObject( " ADODB.Connection" )
516
514
With cnn
517
515
.ConnectionString = sOleDbConnectionstring
518
516
.ConnectionTimeout = m_CheckConnectionTimeout
@@ -587,7 +585,7 @@ End Function
587
585
Public Property Get OledbConnectionString() As String
588
586
589
587
If Len(m_OledbConnectionString) = 0 Then
590
- setConnectionStrings
588
+ SetConnectionStrings
591
589
End If
592
590
OledbConnectionString = m_OledbConnectionString
593
591
@@ -609,7 +607,7 @@ End Property
609
607
Public Property Get OdbcConnectionString(Optional ByVal bWithoutUserInfo As Boolean = False ) As String
610
608
611
609
If Len(m_OdbcConnectionString) = 0 Then
612
- setConnectionStrings
610
+ SetConnectionStrings
613
611
End If
614
612
If bWithoutUserInfo Then
615
613
OdbcConnectionString = Replace(m_OdbcConnectionString, getOdbcUserInfo(), "" )
@@ -634,7 +632,7 @@ End Property
634
632
Public Property Get DatabaseFile() As String
635
633
636
634
If Len(m_DatabaseFile) = 0 Then
637
- setConnectionStrings
635
+ SetConnectionStrings
638
636
End If
639
637
DatabaseFile = m_DatabaseFile
640
638
@@ -653,11 +651,11 @@ End Property
653
651
' </remarks>
654
652
'**/
655
653
'---------------------------------------------------------------------------------------
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
657
655
658
- If Not withoutServerCheck Then
656
+ If Not WithoutServerCheck Then
659
657
If Not m_DbmsInfoReaded Then
660
- setConnectionStrings
658
+ SetConnectionStrings
661
659
End If
662
660
End If
663
661
@@ -672,7 +670,7 @@ End Property
672
670
'---------------------------------------------------------------------------------------
673
671
' Property: DbUserPassword
674
672
'---------------------------------------------------------------------------------------
675
- '/** 'nicht exportieren (2. * für Export fehlt)
673
+ '/**
676
674
' <summary>
677
675
' Passwort des Datenbankbenutzers, das bei Anmeldung eingegeben wurde
678
676
' </summary>
@@ -682,10 +680,10 @@ End Property
682
680
' </remarks>
683
681
'**/
684
682
'---------------------------------------------------------------------------------------
685
- Public Property Get DbUserPassword() As String
683
+ Private Property Get DbUserPassword() As String
686
684
687
685
If Not m_DbmsInfoReaded Then
688
- setConnectionStrings
686
+ SetConnectionStrings
689
687
End If
690
688
DbUserPassword = m_DBUSERPWD
691
689
@@ -706,7 +704,7 @@ End Property
706
704
Public Property Get SavePassword() As Boolean
707
705
708
706
If Not m_DbmsInfoReaded Then
709
- setConnectionStrings
707
+ SetConnectionStrings
710
708
End If
711
709
SavePassword = m_SAVEPWD
712
710
@@ -727,7 +725,7 @@ End Property
727
725
Public Property Get UseLoginForm() As Boolean
728
726
729
727
If Not m_DbmsInfoReaded Then
730
- setConnectionStrings
728
+ SetConnectionStrings
731
729
End If
732
730
UseLoginForm = m_UseLoginForm
733
731
@@ -838,7 +836,7 @@ Public Function ChangeDbUserPassword( _
838
836
839
837
If strLoginName = m_DBUSER Then
840
838
m_DBUSERPWD = NewPassword
841
- setConnectionStrings
839
+ SetConnectionStrings
842
840
RaiseEvent PasswordChanged
843
841
End If
844
842
@@ -1361,7 +1359,11 @@ End Property
1361
1359
'**/
1362
1360
'---------------------------------------------------------------------------------------
1363
1361
Public 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
1365
1367
End Property
1366
1368
1367
1369
Public Property Let LoginFormName(ByVal NewValue As String )
0 commit comments