Skip to content

Commit e9c5a97

Browse files
committed
Optimized: Localization, CodeModulTransfer
1 parent 6c9981c commit e9c5a97

13 files changed

+123
-74
lines changed
-24 KB
Binary file not shown.

source/CodeModulSupport.bas

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Attribute VB_Name = "CodeModulSupport"
2+
Option Compare Database
3+
Option Explicit
4+
5+
Private Const ConditionalCompilationArgumentsOptionName As String = "Conditional Compilation Arguments"
6+
Private Const CONFIG_USELOGINFORM_ArgName As String = "CONFIG_USELOGINFORM"
7+
8+
Public Sub CheckConditionalCompilationArgumentsString(ByVal UseLoginForm As Boolean)
9+
10+
Dim ConditionalCompilationArgumentsString As String
11+
Dim ConditionalCompilationArguments() As String
12+
Dim TestString As String
13+
Dim ArgExists As Boolean
14+
Dim i As Long
15+
16+
ConditionalCompilationArgumentsString = Trim(Nz(Application.GetOption(ConditionalCompilationArgumentsOptionName), vbNullString))
17+
18+
If Len(ConditionalCompilationArgumentsString) = 0 And UseLoginForm Then
19+
Application.SetOption ConditionalCompilationArgumentsOptionName, CONFIG_USELOGINFORM_ArgName & " = " & Abs(UseLoginForm)
20+
Exit Sub
21+
End If
22+
23+
ConditionalCompilationArguments = GetConditionalCompilationArgumentsArray(ConditionalCompilationArgumentsString)
24+
For i = LBound(ConditionalCompilationArguments) To UBound(ConditionalCompilationArguments)
25+
If Replace(ConditionalCompilationArguments(i), " ", vbNullString) Like CONFIG_USELOGINFORM_ArgName & "=*" Then
26+
ConditionalCompilationArguments(i) = CONFIG_USELOGINFORM_ArgName & " = " & Abs(UseLoginForm)
27+
ArgExists = True
28+
Exit For
29+
End If
30+
Next
31+
32+
If ArgExists Then
33+
ConditionalCompilationArgumentsString = Join(ConditionalCompilationArguments, ":")
34+
Else
35+
ConditionalCompilationArgumentsString = ConditionalCompilationArgumentsString & " : " & CONFIG_USELOGINFORM_ArgName & " = " & Abs(UseLoginForm)
36+
End If
37+
38+
ConditionalCompilationArgumentsString = Trim(ConditionalCompilationArgumentsString)
39+
If Left(ConditionalCompilationArgumentsString, 1) = ":" Then
40+
ConditionalCompilationArgumentsString = Trim(Mid(ConditionalCompilationArgumentsString, 2))
41+
End If
42+
If Right(ConditionalCompilationArgumentsString, 1) = ":" Then
43+
ConditionalCompilationArgumentsString = Trim(Left(ConditionalCompilationArgumentsString, Len(ConditionalCompilationArgumentsString) - 1))
44+
End If
45+
46+
Application.SetOption ConditionalCompilationArgumentsOptionName, ConditionalCompilationArgumentsString
47+
48+
End Sub
49+
50+
Private Function GetConditionalCompilationArgumentsArray(ByVal FullString As String) As String()
51+
GetConditionalCompilationArgumentsArray = Split(FullString, ":")
52+
End Function

source/_initDbConnectionWizard.bas

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Attribute VB_Name = "_initDbConnectionWizard"
22
'---------------------------------------------------------------------------------------
3-
' Modul: _initApplication (2009-07-08)
3+
' Modul: _initApplication
44
'---------------------------------------------------------------------------------------
55
'/* *
66
' <summary>
@@ -16,33 +16,33 @@ Option Explicit
1616
'---------------------------
1717
' Initialisierungsfunktion
1818
'---------------------------
19-
Private Function initDbmsConnectionWizard() As Boolean
19+
Private Function InitDbmsConnectionWizard() As Boolean
2020
If Application.CurrentDb Is Nothing Then
2121
MsgBox "Bitte öffnen Sie zuerst eine Access-Anwendung.", vbCritical
22-
initDbmsConnectionWizard = False
22+
InitDbmsConnectionWizard = False
2323
Exit Function
2424
End If
25-
initDbmsConnectionWizard = StartApplication
25+
InitDbmsConnectionWizard = StartApplication
2626
End Function
2727

2828
Public Function StartDbmsConnectionWizard() As Variant
29-
If Not initDbmsConnectionWizard Then Exit Function
30-
checkTemplatesDb
29+
If Not InitDbmsConnectionWizard Then Exit Function
30+
CheckTemplatesDb
3131
DoCmd.OpenForm DCW_DbmsConfigFormName, acNormal, , , , acWindowNormal
3232
End Function
3333

3434
Public Function StartDbmsConnectionLinkTableWizard() As Variant
35-
If Not initDbmsConnectionWizard Then Exit Function
35+
If Not InitDbmsConnectionWizard Then Exit Function
3636
DoCmd.OpenForm DCW_LinkTablesFormName, acNormal, , , , acWindowNormal
3737
End Function
3838

3939
Public Function CreatePassThroughQuery() As Variant
40-
If Not initDbmsConnectionWizard Then Exit Function
40+
If Not InitDbmsConnectionWizard Then Exit Function
4141
DoCmd.OpenForm DCW_TestSqlFormName, acNormal, , , , acWindowNormal, DCW_RecordsetModes.DCW_DAOPT
4242
End Function
4343

4444
Public Function InsertOdbcConnectionString(ByRef strObjektName As String, ByRef strTextFeldname As String, ByRef strAktuellerWert As String) As Variant
45-
If Not initDbmsConnectionWizard Then Exit Function
45+
If Not InitDbmsConnectionWizard Then Exit Function
4646
Select Case strTextFeldname
4747
Case "Query"
4848
strAktuellerWert = CurrentConnectionInfo.OdbcConnectionString
@@ -61,7 +61,7 @@ End Sub
6161
'
6262
' Hilfsprozeduren
6363

64-
Private Sub checkTemplatesDb()
64+
Private Sub CheckTemplatesDb()
6565

6666
Dim db As DAO.Database
6767
Dim tdf As DAO.TableDef

source/codelib/_codelib/addins/shared/ACLibGitHubImporter.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Private Sub UpdateCodeModuleInTable(ByVal ModuleName As String, ByVal ACLibPath
9595
Dim DownLoadUrl As String
9696
Dim BranchName As String
9797

98-
TempFile = FileTools.TempPath & ModuleName & ".cls"
98+
TempFile = FileTools.TempPath & ModuleName & FileTools.GetFileExtension(ACLibPath, True)
9999

100100
If UseDraftBranch Then
101101
BranchName = "draft"

source/codelib/_codelib/addins/shared/AppFileCodeModulTransfer.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Public Function CheckCodeModule(ByVal ModulName As String, _
132132

133133
End Function
134134

135-
Private Sub TransferCodeModul(ByVal TargetProject As Access.CurrentProject, _
135+
Public Sub TransferCodeModul(ByVal TargetProject As Access.CurrentProject, _
136136
ByVal ObjType As AcObjectType, ByVal ModulName As String)
137137

138138
Dim FileName As String

source/codelib/data/DbConnectionInfo.cls

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Private Enum DbConnectionInfoErrorNumbers
3434
ERRNR_INACTIVE = vbObjectError + 3
3535
End Enum
3636

37+
Private Const m_DefaultLoginFormName As String = "LoginForm"
3738
Private m_LoginFormName As String
3839
Private m_DbmsConfigFormName As String
3940

@@ -86,7 +87,7 @@ Private m_UseLoginForm As Boolean
8687
Private 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
9091
Attribute 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

427425
End 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

505503
Private 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
587585
Public 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
609607
Public 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
634632
Public 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
706704
Public 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
727725
Public 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
'---------------------------------------------------------------------------------------
13631361
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
13651367
End Property
13661368

13671369
Public Property Let LoginFormName(ByVal NewValue As String)

source/codelib/data/DbConnectionSettings.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Klassenmodul: DbConnectionInfo
11+
' Klassenmodul: DbConnectionSettings
1212
'---------------------------------------------------------------------------------------
1313
'/**
1414
' <summary>

source/codelib/data/modDbConnection.bas

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ Public Sub DisposeDbConnection()
9595

9696
On Error Resume Next
9797

98-
#If CONFIG_USELOGINFORM = 1 Then
99-
Set g_TempRef = Nothing
100-
#End If
101-
10298
If Not (m_DbConnectionManager Is Nothing) Then
10399
m_DbConnectionManager.Dispose
104100
End If
29.9 KB
Binary file not shown.

source/defDbmsConnectionWizard.bas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ Option Private Module
1515

1616
Public Const DCW_AppName As String = "DbmsConnectionWizard"
1717
Public Const DCW_AppFullName As String = "DBMS Connection Wizard"
18-
Public Const DCW_Version As String = "1.4.1"
19-
Public Const DCW_VersionDate As String = "2023-05-24"
18+
Public Const DCW_Version As String = "1.4.2"
19+
Public Const DCW_VersionDate As String = "2023-05-26"
2020

2121
'Formulare
22-
Public Const DCW_LoginFormName As String = g_ApplicationLoginFormName
22+
Public Const DCW_LoginFormName As String = "LoginForm"
2323
Public Const DCW_DbmsConfigFormName As String = "frmConfig_DBMS"
2424
Public Const DCW_LinkTablesFormName As String = "frmConfig_LinkTables"
2525
Public Const DCW_TestSqlFormName As String = "frmTest_SQL"

0 commit comments

Comments
 (0)