Skip to content

Commit a9e5629

Browse files
authored
Use msaccess vcs for add in source (#31)
* start with msaccess-vcs for Access add-in
1 parent a54b0a5 commit a9e5629

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+17835
-693
lines changed

access-add-in/.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Version Control Add-in Binaries
2+
# (This should be built from source and not committed to version control)
3+
*.accda
4+
*.accdb
5+
*.zip
6+
7+
# Database lock files
8+
*.laccdb
9+
10+
# Comment out the following line if you wish to include the log files in git.
11+
*.log
12+
13+
# The local VCS index file is paired with the database and should not
14+
# be comitted to version control.
15+
vcs-index.json
16+
17+
# Ignore any dotenv files (used for external database connections)
18+
*.env
19+
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
$AddInName = "ACLib-AccUnit-Loader"
2+
$AddInFileName = "AccUnitLoader.accda"
3+
$MsgBoxTitle = "Update ACLib-AccUnit-Loader"
4+
5+
6+
function Get-SourceFileFullName {
7+
$ScriptLocation = Get-ScriptLocation
8+
$retVal = '' + $ScriptLocation + $AddInFileName
9+
$retVal
10+
}
11+
12+
function Get-DestFileFullName {
13+
$AddInLocation = Get-AddInLocation
14+
$retVal = $AddInLocation + $AddInFileName
15+
$retVal
16+
}
17+
18+
function Get-ScriptLocation {
19+
$retVal = '' + $PSScriptRoot + "\"
20+
$retVal
21+
}
22+
23+
function Get-AddInLocation {
24+
$env:APPDATA + "\Microsoft\AddIns\"
25+
}
26+
27+
function FileCopy {
28+
Param($SourceFilePath, $DestFilePath)
29+
Copy-Item $SourceFilePath -Destination $DestFilePath
30+
$true
31+
}
32+
33+
function Delete-AddInFiles {
34+
35+
$DestFile = Get-DestFileFullName
36+
$AddInLocation = Get-AddInLocation
37+
$tlbPath = "\lib\AccessCodeLib.AccUnit.tlb"
38+
$Tlbfile = $AddInLocation + $tlbPath
39+
40+
# Remove-Item -Path $DestFile -Force
41+
# Remove-Item -Path $Tlbfile -Force
42+
43+
}
44+
45+
function CopyFileAndRunPrecompileProc {
46+
47+
Param($SourceFilePath, $DestFilePath)
48+
49+
[System.Windows.Forms.MessageBox]::Show($SourceFilePath, "SourceFilePath", 0)
50+
51+
52+
#Copy-Item -Path $SourceFilePath -Destination $DestFilePath
53+
54+
$ret = Run-PrecompileProcedure $DestFilePath
55+
If ($ret -eq $true) {
56+
$true
57+
}
58+
else {
59+
$false
60+
}
61+
}
62+
63+
function CreateMde {
64+
Param($SourceFilePath, $DestFilePath)
65+
66+
Delete-AddInFiles
67+
68+
$FileToCompile = $DestFilePath + ".accdb"
69+
$copied = FileCopy $SourceFilePath $FileToCompile
70+
If ($copied -ne $true) {
71+
return
72+
}
73+
74+
#$AccessApp = New-Object -ComObject Access.Application
75+
$ret = Run-PrecompileProcedure $FileToCompile
76+
If ($ret -ne $true) {
77+
return
78+
}
79+
80+
return
81+
82+
$AccessApp.SysCmd(603, ($FileToCompile), ($DestFilePath))
83+
84+
Remove-Item -Path $FileToCompile -Force
85+
86+
$true
87+
88+
}
89+
90+
function Run-PrecompileProcedure {
91+
Param([string]$AccdbFilePath)
92+
93+
$AccessApp = New-Object -ComObject Access.Application
94+
$AccessApp.Visible = $true
95+
96+
$AccessApp.OpenCurrentDatabase("" + $AccdbFilePath)
97+
98+
$RunMethod = "CheckAccUnitTypeLibFile"
99+
$AccessApp.Run($RunMethod)
100+
$AccessApp.CloseCurrentDatabase
101+
102+
$true
103+
104+
}
105+
106+
107+
####main
108+
109+
110+
$msg = "Before updating the add-in file, the add-in must not be loaded!
111+
For safety, close all Access instances."
112+
113+
[System.Windows.Forms.MessageBox]::Show($msg, $MsgBoxTitle + ": Information", 0)
114+
115+
$msg ="Should the add-in be used as a compiled file (accde)?
116+
(Add-In is compiled and copied to the Add-In directory.)"
117+
118+
$msgRet = [System.Windows.Forms.MessageBox]::Show($msg, $MsgBoxTitle, 3)
119+
120+
$AddInLocation = Get-AddInLocation
121+
122+
switch ( $msgRet )
123+
{
124+
"Yes" {
125+
$AddInFileInstalled = $true # CreateMde(GetSourceFileFullName, GetDestFileFullName)
126+
127+
If ( $AddInFileInstalled -eq $true ) {
128+
$CompletedMsg = "Add-In was compiled and saved in '" + $AddInLocation + "'."
129+
}
130+
Else {
131+
$CompletedMsg = "Error! Compiled file was not created."
132+
}
133+
134+
}
135+
136+
"No" {
137+
#Delete-AddInFiles
138+
$SourceFileFullName = Get-SourceFileFullName
139+
$DestFileFullName = Get-DestFileFullName
140+
$AddInFileInstalled = CopyFileAndRunPrecompileProc $SourceFileFullName $DestFileFullName
141+
If ( $AddInFileInstalled ) {
142+
$CompletedMsg = "Add-In was saved in '" + $AddInLocation + "'."
143+
}
144+
Else {
145+
$CompletedMsg = "Error! File was not copied."
146+
}
147+
}
148+
149+
default {
150+
return
151+
}
152+
}
153+
154+
[System.Windows.Forms.MessageBox]::Show($CompletedMsg, $MsgBoxTitle, 0)
155+

access-add-in/New Text Document.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.
-139 KB
Binary file not shown.
-86.9 KB
Binary file not shown.

access-add-in/source/GetAccUnitFactory.bas

Lines changed: 0 additions & 17 deletions
This file was deleted.

access-add-in/source/codelib/base/defGlobal.bas

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)