Permalink
Browse files

Merge branch 'master' of https://github.com/matonb/msaccess-vcs-integ…

…ration into matonb-master
  • Loading branch information...
2 parents 65c71f4 + dac2307 commit e8e0c173acb93a124923894dc4fe421f596b2c5d @bkidwell committed Apr 6, 2013
Showing with 220 additions and 198 deletions.
  1. +205 −194 AppCodeImportExport.bas
  2. +13 −2 CHANGELOG.md
  3. +2 −2 README.md
  4. BIN demo/demo.accdb
View
399 AppCodeImportExport.bas 100644 → 100755
@@ -1,7 +1,7 @@
' Access Module `AppCodeImportExport`
' -----------------------------------
'
-' Version 0.2
+' Version 0.3
'
' https://github.com/bkidwell/msaccess-vcs-integration
'
@@ -31,6 +31,7 @@
' * Maybe integrate into a dialog box triggered by a menu item.
' * Warning of destructive overwrite.
+Attribute VB_Name = "AppCodeImportExport"
Option Compare Database
Option Explicit
@@ -44,11 +45,6 @@ Option Explicit
Private Const INCLUDE_TABLES = ""
-' --------------------------------
-' Structures
-' --------------------------------
-
-' Structure to track buffered reading or writing of binary files
Private Type BinFile
file_num As Integer
file_len As Long
@@ -64,26 +60,40 @@ End Type
' Constants
' --------------------------------
-' Constants for Scripting.FileSystemObject API
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateTrue = -1, TristateFalse = 0, TristateUseDefault = -2
+Const AggressiveSanitize = 0
' --------------------------------
' Module variables
' --------------------------------
-' Does the current database file write UCS2-little-endian when exporting
-' Queries, Forms, Reports, Macros
-Private UsingUcs2 As Boolean
+Private UsingUcs2_Result As String
' --------------------------------
-' Basic functions missing from VB 6: buffered file read/write, string builder
+' Beginning of main functions of this module
' --------------------------------
+Private Function CloseFormsReports()
+'
+'Close all open forms
+
+ On Error GoTo ErrorHandler
+ Do While Forms.count > 0
+ DoCmd.Close acForm, Forms(0).Name
+ Loop
+ Do While Reports.count > 0
+ DoCmd.Close acReport, Reports(0).Name
+ Loop
+
+ Exit Function
+ErrorHandler:
+ Debug.Print "AppCodeImportExport.CloseFormsReports: Error #" & Err.Number & vbCrLf & Err.description
+
+End Function
-' Open a binary file for reading (mode = 'r') or writing (mode = 'w').
Private Function BinOpen(file_path As String, mode As String) As BinFile
Dim f As BinFile
-
+
f.file_num = FreeFile
f.mode = LCase(mode)
If f.mode = "r" Then
@@ -108,19 +118,18 @@ Private Function BinOpen(file_path As String, mode As String) As BinFile
f.buffer_len = 0
f.buffer_pos = 0
End If
-
+
BinOpen = f
End Function
-' Buffered read one byte at a time from a binary file.
Private Function BinRead(ByRef f As BinFile) As Integer
If f.at_eof = True Then
BinRead = 0
Exit Function
End If
-
+
BinRead = Asc(Mid(f.buffer, f.buffer_pos + 1, 1))
-
+
f.buffer_pos = f.buffer_pos + 1
If f.buffer_pos >= f.buffer_len Then
f.file_pos = f.file_pos + &H4000
@@ -139,7 +148,6 @@ Private Function BinRead(ByRef f As BinFile) As Integer
End If
End Function
-' Buffered write one byte at a time from a binary file.
Private Sub BinWrite(ByRef f As BinFile, b As Integer)
Mid(f.buffer, f.buffer_pos + 1, 1) = Chr(b)
f.buffer_pos = f.buffer_pos + 1
@@ -149,7 +157,6 @@ Private Sub BinWrite(ByRef f As BinFile, b As Integer)
End If
End Sub
-' Close binary file.
Private Sub BinClose(ByRef f As BinFile)
If f.mode = "w" And f.buffer_pos > 0 Then
f.buffer = Left(f.buffer, f.buffer_pos)
@@ -158,51 +165,18 @@ Private Sub BinClose(ByRef f As BinFile)
Close f.file_num
End Sub
-' String builder: Init
-Private Function Sb_Init() As String()
- Dim x(-1 To -1) As String
- Sb_Init = x
-End Function
-
-' String builder: Clear
-Private Sub Sb_Clear(ByRef sb() As String)
- ReDim Sb_Init(-1 To -1)
-End Sub
-
-' String builder: Append
-Private Sub Sb_Append(ByRef sb() As String, value As String)
- If LBound(sb) = -1 Then
- ReDim sb(0 To 0)
- Else
- ReDim Preserve sb(0 To UBound(sb) + 1)
- End If
- sb(UBound(sb)) = value
-End Sub
-
-' String builder: Get value
-Private Function Sb_Get(ByRef sb() As String) As String
- Sb_Get = Join(sb, "")
-End Function
-
-' --------------------------------
-' Beginning of main functions of this module
-' --------------------------------
-
-' Path of the current database file.
Private Function ProjectPath() As String
ProjectPath = CurrentProject.Path
If Right(ProjectPath, 1) <> "\" Then ProjectPath = ProjectPath & "\"
End Function
-' Path of single temp file used by any function in this module.
Private Function TempFile() As String
TempFile = ProjectPath() & "AppCodeImportExport.tempdata"
End Function
-' Export a database object with optional UCS2-to-UTF-8 conversion.
Private Sub ExportObject(obj_type_num As Integer, obj_name As String, file_path As String, _
Optional Ucs2Convert As Boolean = False)
-
+
MkDirIfNotExist Left(file_path, InStrRev(file_path, "\"))
If Ucs2Convert Then
Application.SaveAsText obj_type_num, obj_name, TempFile()
@@ -212,9 +186,11 @@ Private Sub ExportObject(obj_type_num As Integer, obj_name As String, file_path
End If
End Sub
-' Import a database object with optional UTF-8-to-UCS2 conversion.
Private Sub ImportObject(obj_type_num As Integer, obj_name As String, file_path As String, _
Optional Ucs2Convert As Boolean = False)
+'
+' Been getting "reserved" errors if a form is open....
+ CloseFormsReports
If Ucs2Convert Then
ConvertUtf8Ucs2 file_path, TempFile()
@@ -224,14 +200,13 @@ Private Sub ImportObject(obj_type_num As Integer, obj_name As String, file_path
End If
End Sub
-' Binary convert a UCS2-little-endian encoded file to UTF-8.
Private Sub ConvertUcs2Utf8(source As String, dest As String)
Dim f_in As BinFile, f_out As BinFile
Dim in_low As Integer, in_high As Integer
f_in = BinOpen(source, "r")
f_out = BinOpen(dest, "w")
-
+
Do While Not f_in.at_eof
in_low = BinRead(f_in)
in_high = BinRead(f_in)
@@ -254,14 +229,13 @@ Private Sub ConvertUcs2Utf8(source As String, dest As String)
BinClose f_out
End Sub
-' Binary convert a UTF-8 encoded file to UCS2-little-endian.
Private Sub ConvertUtf8Ucs2(source As String, dest As String)
Dim f_in As BinFile, f_out As BinFile
Dim in_1 As Integer, in_2 As Integer, in_3 As Integer
-
+
f_in = BinOpen(source, "r")
f_out = BinOpen(dest, "w")
-
+
Do While Not f_in.at_eof
in_1 = BinRead(f_in)
If (in_1 And &H80) = 0 Then
@@ -281,21 +255,30 @@ Private Sub ConvertUtf8Ucs2(source As String, dest As String)
BinWrite f_out, ((in_1 And &HF) * &H10) + ((in_2 And &H3C) / &H4)
End If
Loop
-
+
BinClose f_in
BinClose f_out
End Sub
-' Determine if this database imports/exports code as UCS-2-LE. (Older file
-' formats cause exported objects to use a Windows 8-bit character set.)
-Private Sub InitUsingUcs2()
+Public Sub TestExportUcs2()
+ ExportObject acForm, "example_form", ProjectPath & "output.txt", True
+ ConvertUtf8Ucs2 ProjectPath & "output.txt", ProjectPath & "output_ucs2.txt"
+End Sub
+
+' Determine if this database imports/exports code as UCS-2-LE
+Private Function UsingUcs2() As Boolean
Dim obj_name As String, i As Integer, obj_type As Variant, fn As Integer, bytes As String
Dim obj_type_split() As String, obj_type_name As String, obj_type_num As Integer
Dim db As Object ' DAO.Database
+ If UsingUcs2_Result <> "" Then
+ UsingUcs2 = (UsingUcs2_Result = "1")
+ Exit Function
+ End If
+
If CurrentDb.QueryDefs.count > 0 Then
obj_type_num = acQuery
- obj_name = CurrentDb.QueryDefs(0).Name
+ obj_name = CurrentDb.QueryDefs(1).Name
Else
For Each obj_type In Split( _
"Forms|" & acForm & "," & _
@@ -312,11 +295,12 @@ Private Sub InitUsingUcs2()
End If
Next
End If
-
+
If obj_name = "" Then
' No objects found that can be used to test UCS2 versus UTF-8
+ UsingUcs2_Result = "1"
UsingUcs2 = True
- Exit Sub
+ Exit Function
End If
Application.SaveAsText obj_type_num, obj_name, TempFile()
@@ -325,11 +309,18 @@ Private Sub InitUsingUcs2()
bytes = " "
Get fn, 1, bytes
If Asc(Mid(bytes, 1, 1)) = &HFF And Asc(Mid(bytes, 2, 1)) = &HFE Then
+ UsingUcs2_Result = "1"
UsingUcs2 = True
Else
+ UsingUcs2_Result = "0"
UsingUcs2 = False
End If
Close fn
+End Function
+
+Public Sub TestUsingUcs2()
+ UsingUcs2_Result = ""
+ Debug.Print UsingUcs2()
End Sub
' Create folder `Path`. Silently do nothing if it already exists.
@@ -348,18 +339,18 @@ DelIfNotExist_Noop:
On Error GoTo 0
End Sub
-' Erase all *.`ext` files in `Path`.
+' Erase all *.data and *.txt files in `Path`.
Private Sub ClearTextFilesFromDir(Path As String, Ext As String)
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(Path) Then Exit Sub
-
+
On Error GoTo ClearTextFilesFromDir_noop
If Dir(Path & "*." & Ext) <> "" Then
- Kill Path & "*." & Ext
+ Kill Path & "*.data" & Ext
End If
ClearTextFilesFromDir_noop:
-
+
On Error GoTo 0
End Sub
@@ -369,13 +360,16 @@ End Sub
' version control).
Private Sub SanitizeTextFiles(Path As String, Ext As String)
Dim fso, InFile, OutFile, FileName As String, txt As String, obj_name As String
-
+
+ Dim ForReading As Long
+
+ ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
-
+
FileName = Dir(Path & "*." & Ext)
Do Until Len(FileName) = 0
obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
-
+
Set InFile = fso.OpenTextFile(Path & obj_name & "." & Ext, ForReading)
Set OutFile = fso.CreateTextFile(Path & obj_name & ".sanitize", True)
Do Until InFile.AtEndOfStream
@@ -388,8 +382,13 @@ Private Sub SanitizeTextFiles(Path As String, Ext As String)
InStr(txt, "PrtDevNamesW = Begin") > 0 Or _
InStr(txt, "PrtDevModeW = Begin") > 0 Or _
InStr(txt, "PrtDevMode = Begin") > 0 Or _
- InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Then
-
+ InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Or _
+ (AggressiveSanitize > 0 And _
+ InStr(txt, "dbLongBinary ""DOL"" = Begin") > 0 Or _
+ InStr(txt, "NameMap") > 0 Or _
+ InStr(txt, "GUID") _
+ ) Then
+
' skip this block of code
Do Until InFile.AtEndOfStream
txt = InFile.ReadLine
@@ -401,10 +400,10 @@ Private Sub SanitizeTextFiles(Path As String, Ext As String)
Loop
OutFile.Close
InFile.Close
-
+
FileName = Dir()
Loop
-
+
FileName = Dir(Path & "*." & Ext)
Do Until Len(FileName) = 0
obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
@@ -430,33 +429,46 @@ Public Sub ExportAllSource()
Dim obj_type_num As Integer
Dim ucs2 As Boolean
Dim tblName As Variant
+ Dim obj_count As Integer
+
+ '
+ ' Been getting "reserved" errors if a form was open.
+ CloseFormsReports
Set db = CurrentDb
- InitUsingUcs2
-
+
source_path = ProjectPath() & "source\"
MkDirIfNotExist source_path
-
+
Debug.Print
-
+
obj_path = source_path & "queries\"
ClearTextFilesFromDir obj_path, "bas"
- Debug.Print "Exporting queries..."
- For Each qry In db.QueryDefs
- If Left(qry.Name, 1) <> "~" Then
- ExportObject acQuery, qry.Name, obj_path & qry.Name & ".bas", UsingUcs2
- End If
- Next
-
+ If (db.QueryDefs.count > 0) Then
+ obj_count = 0
+ Debug.Print "Exporting queries "; Tab(20);
+ For Each qry In db.QueryDefs
+ If Left(qry.Name, 1) <> "~" Then
+ ExportObject acQuery, qry.Name, obj_path & qry.Name & ".bas", UsingUcs2()
+ obj_count = obj_count + 1
+ If (AggressiveSanitize > 0) Then: SanitizeTextFiles obj_path, "bas"
+ End If
+ Next
+ Debug.Print "[" & obj_count & "]"
+ End If
+
obj_path = source_path & "tables\"
ClearTextFilesFromDir obj_path, "txt"
If (Len(Replace(INCLUDE_TABLES, " ", "")) > 0) Then
- Debug.Print "Exporting tables..."
+ obj_count = 0
+ Debug.Print "Exporting tables"; Tab(20);
For Each tblName In Split(INCLUDE_TABLES, ",")
ExportTable CStr(tblName), obj_path
+ obj_count = obj_count + 1
Next
+ Debug.Print "[" & obj_count & "]"
End If
-
+
For Each obj_type In Split( _
"forms|Forms|" & acForm & "," & _
"reports|Reports|" & acReport & "," & _
@@ -470,23 +482,29 @@ Public Sub ExportAllSource()
obj_type_num = Val(obj_type_split(2))
obj_path = source_path & obj_type_label & "\"
ClearTextFilesFromDir obj_path, "bas"
- Debug.Print "Exporting " & obj_type_label & "..."
- For Each doc In db.Containers(obj_type_name).Documents
- If Left(doc.Name, 1) <> "~" Then
- If obj_type_label = "modules" Then
- ucs2 = False
- Else
- ucs2 = UsingUcs2
+ '
+ ' Export objects (if there are any).
+ If (db.Containers(obj_type_name).Documents.count > 0) Then
+ Debug.Print "Exporting " & obj_type_label; Tab(20);
+ obj_count = 0
+ For Each doc In db.Containers(obj_type_name).Documents
+ If Left(doc.Name, 1) <> "~" Then
+ If obj_type_label = "modules" Then
+ ucs2 = False
+ Else
+ ucs2 = UsingUcs2()
+ End If
+ ExportObject obj_type_num, doc.Name, obj_path & doc.Name & ".bas", ucs2
+ obj_count = obj_count + 1
End If
- ExportObject obj_type_num, doc.Name, obj_path & doc.Name & ".bas", ucs2
+ Next
+ Debug.Print "[" & obj_count & "]"
+ If obj_type_label <> "modules" Then
+ SanitizeTextFiles obj_path, "bas"
End If
- Next
-
- If obj_type_label <> "modules" Then
- SanitizeTextFiles obj_path, "bas"
End If
Next
-
+
DelIfExist TempFile()
Debug.Print "Done."
End Sub
@@ -509,38 +527,51 @@ Public Sub ImportAllSource()
Dim FileName As String
Dim obj_name As String
Dim ucs2 As Boolean
-
+ Dim obj_count As Integer
+
+ '
+ ' Getting "reserved" error if a form was open during import.
+ CloseFormsReports
+
Set db = CurrentDb
Set fso = CreateObject("Scripting.FileSystemObject")
- InitUsingUcs2
source_path = ProjectPath() & "source\"
If Not fso.FolderExists(source_path) Then
- MsgBox "No source found at:" & vbCrLf & source_path, vbExclamation, "Import failed"
+ MsgBox "No source found at:" & vbCrLf & source_path, vbExclamation, "Warning"
Exit Sub
End If
-
+
Debug.Print
-
+
obj_path = source_path & "queries\"
FileName = Dir(obj_path & "*.bas")
- If Len(FileName) > 0 Then: Debug.Print "Importing queries..."
- Do Until Len(FileName) = 0
- obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
- ImportObject acQuery, obj_name, obj_path & FileName, UsingUcs2
- FileName = Dir()
- Loop
-
- '' read in table values
+ If Len(FileName) > 0 Then
+ Debug.Print "Importing queries"; Tab(20);
+ obj_count = 0
+ Do Until Len(FileName) = 0
+ obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
+ ImportObject acQuery, obj_name, obj_path & FileName, UsingUcs2()
+ obj_count = obj_count + 1
+ FileName = Dir()
+ Loop
+ Debug.Print "[" & obj_count & "]"
+ End If
+ '
+ ' read in table values
obj_path = source_path & "tables\"
FileName = Dir(obj_path & "*.txt")
- If Len(FileName) > 0 Then: Debug.Print "Importing tables..."
- Do Until Len(FileName) = 0
- obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
- ImportTable CStr(obj_name), obj_path
- FileName = Dir()
- Loop
-
+ If Len(FileName) > 0 Then
+ Debug.Print "Importing tables"; Tab(20);
+ obj_count = 0
+ Do Until Len(FileName) = 0
+ obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
+ ImportTable CStr(obj_name), obj_path
+ obj_count = obj_count + 1
+ FileName = Dir()
+ Loop
+ Debug.Print "[" & obj_count & "]"
+ End If
For Each obj_type In Split( _
"forms|" & acForm & "," & _
"reports|" & acReport & "," & _
@@ -553,98 +584,76 @@ Public Sub ImportAllSource()
obj_type_num = Val(obj_type_split(1))
obj_path = source_path & obj_type_label & "\"
FileName = Dir(obj_path & "*.bas")
- If Len(FileName) > 0 Then: Debug.Print "Importing " & obj_type_label & "..."
- Do Until Len(FileName) = 0
- obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
- If obj_name <> "AppCodeImportExport" Then
- If obj_type_label = "modules" Then
- ucs2 = False
- Else
- ucs2 = UsingUcs2
+ If Len(FileName) > 0 Then
+ Debug.Print "Importing " & obj_type_label; Tab(20);
+ obj_count = 0
+ Do Until Len(FileName) = 0
+ obj_name = Mid(FileName, 1, InStrRev(FileName, ".") - 1)
+ If obj_name <> "AppCodeImportExport" Then
+ If obj_type_label = "modules" Then
+ ucs2 = False
+ Else
+ ucs2 = UsingUcs2()
+ End If
+ ImportObject obj_type_num, obj_name, obj_path & FileName, ucs2
+ obj_count = obj_count + 1
End If
- ImportObject obj_type_num, obj_name, obj_path & FileName, ucs2
- End If
- FileName = Dir()
- Loop
+ FileName = Dir()
+ Loop
+ Debug.Print "[" & obj_count & "]"
+ End If
Next
-
+
DelIfExist TempFile()
Debug.Print "Done."
End Sub
-' Build SQL to export `tbl_name` sorted by each field from first to last
-Public Function TableExportSql(tbl_name As String)
- Dim rs As Object ' DAO.Recordset
- Dim fieldObj As Object ' DAO.Field
- Dim sb() As String, count As Integer
-
- Set rs = CurrentDb.OpenRecordset(tbl_name)
-
- sb = Sb_Init()
- Sb_Append sb, "SELECT "
- count = 0
- For Each fieldObj In rs.Fields
- If count > 0 Then Sb_Append sb, ", "
- Sb_Append sb, "[" & fieldObj.Name & "]"
- count = count + 1
- Next
- Sb_Append sb, " FROM [" & tbl_name & "] ORDER BY "
- count = 0
- For Each fieldObj In rs.Fields
- If count > 0 Then Sb_Append sb, ", "
- Sb_Append sb, "[" & fieldObj.Name & "]"
- count = count + 1
- Next
-
- TableExportSql = Sb_Get(sb)
-End Function
-
' Export the lookup table `tblName` to `source\tables`.
-Private Sub ExportTable(tbl_name As String, obj_path As String)
+Private Sub ExportTable(tblName As String, obj_path As String)
Dim fso, OutFile
Dim rs As Object ' DAO.Recordset
Dim fieldObj As Object ' DAO.Field
- Dim C As Long, value As Variant
-
+ Dim C As Long, Value As Variant
+
Set fso = CreateObject("Scripting.FileSystemObject")
' open file for writing with Create=True, Unicode=True (USC-2 Little Endian format)
MkDirIfNotExist obj_path
Set OutFile = fso.CreateTextFile(TempFile(), True, True)
-
- Set rs = CurrentDb.OpenRecordset(TableExportSql(tbl_name))
+
+ Set rs = CurrentDb.OpenRecordset("export_" & tblName)
C = 0
For Each fieldObj In rs.Fields
If C <> 0 Then OutFile.write vbTab
C = C + 1
OutFile.write fieldObj.Name
Next
OutFile.write vbCrLf
-
+
rs.MoveFirst
Do Until rs.EOF
C = 0
For Each fieldObj In rs.Fields
If C <> 0 Then OutFile.write vbTab
C = C + 1
- value = rs(fieldObj.Name)
- If IsNull(value) Then
- value = ""
+ Value = rs(fieldObj.Name)
+ If IsNull(Value) Then
+ Value = ""
Else
- value = Replace(value, "\", "\\")
- value = Replace(value, vbCrLf, "\n")
- value = Replace(value, vbCr, "\n")
- value = Replace(value, vbLf, "\n")
- value = Replace(value, vbTab, "\t")
+ Value = Replace(Value, "\", "\\")
+ Value = Replace(Value, vbCrLf, "\n")
+ Value = Replace(Value, vbCr, "\n")
+ Value = Replace(Value, vbLf, "\n")
+ Value = Replace(Value, vbTab, "\t")
End If
- OutFile.write value
+ OutFile.write Value
Next
OutFile.write vbCrLf
rs.MoveNext
Loop
rs.Close
OutFile.Close
-
- ConvertUcs2Utf8 TempFile(), obj_path & tbl_name & ".txt"
+
+ ConvertUcs2Utf8 TempFile(), obj_path & tblName & ".txt"
End Sub
' Import the lookup table `tblName` from `source\tables`.
@@ -653,39 +662,41 @@ Private Sub ImportTable(tblName As String, obj_path As String)
Dim rs As Object ' DAO.Recordset
Dim fieldObj As Object ' DAO.Field
Dim fso, InFile As Object
- Dim C As Long, buf As String, Values() As String, value As Variant
-
+ Dim C As Long, buf As String, Values() As String, Value As Variant, rsWrite As Recordset
+
Set fso = CreateObject("Scripting.FileSystemObject")
ConvertUtf8Ucs2 obj_path & tblName & ".txt", TempFile()
' open file for reading with Create=False, Unicode=True (USC-2 Little Endian format)
Set InFile = fso.OpenTextFile(TempFile(), ForReading, False, TristateTrue)
Set db = CurrentDb
-
+
db.Execute "DELETE FROM [" & tblName & "]"
- Set rs = db.OpenRecordset(tblName)
+ Set rs = db.OpenRecordset("export_" & tblName)
+ Set rsWrite = db.OpenRecordset(tblName)
buf = InFile.ReadLine()
Do Until InFile.AtEndOfStream
buf = InFile.ReadLine()
If Len(Trim(buf)) > 0 Then
Values = Split(buf, vbTab)
C = 0
- rs.AddNew
+ rsWrite.AddNew
For Each fieldObj In rs.Fields
- value = Values(C)
- If Len(value) = 0 Then
- value = Null
+ Value = Values(C)
+ If Len(Value) = 0 Then
+ Value = Null
Else
- value = Replace(value, "\t", vbTab)
- value = Replace(value, "\n", vbCrLf)
- value = Replace(value, "\\", "\")
+ Value = Replace(Value, "\t", vbTab)
+ Value = Replace(Value, "\n", vbCrLf)
+ Value = Replace(Value, "\\", "\")
End If
- rs(fieldObj.Name) = value
+ rsWrite(fieldObj.Name) = Value
C = C + 1
Next
- rs.Update
+ rsWrite.Update
End If
Loop
-
+
+ rsWrite.Close
rs.Close
InFile.Close
End Sub
View
15 CHANGELOG.md
@@ -1,11 +1,22 @@
Change log
==========
+version 0.3 - 5 Apr 2013
+
+matonb:
+* Added AggressiveSanitize constant, it's a number to allow for different
+ levels in the future. Default 0 (off)
+* Added Skipping for GUID & Namemap in aggressive sanitize mode.
+* If AggressiveSanitize is on, also sanitize query exports.
+* Append [Number] of objects exported to information lines in immediate window.
+* Append [Number] of objects imported to information lines in immediate window.
+* Updated readme (removed references to terminal window).
+* Close all open forms and reports when importing (MS reserved error).
version 0.2 - 4 Apr 2013
------------------------
matonb:
-* Added dbLongBinary "DOL" to SkipList in SanitizeTextFiles.
+* Added dbLongBinary "DOL" to SkipList in SanitizeTextFiles, default 0 (off).
* Added Source directory check to ImportAllSource, pops up a message box if missing.
* Only create source directories if there is something to export.
@@ -18,4 +29,4 @@ bkidwell:
version 0.1 - 22 Oct 2012
-------------------------
-Initial release
+Initial release
View
4 README.md
@@ -46,11 +46,11 @@ First Commit to Your Source Control System
Committing New Progress and Pulling Changes from Other Developers
-----------------------------------------------------------------
-1. Open the application, hit CTRL-G, and run the following VB code in the Immediate window: "`ExportAllSource`". Dismiss the popup command prompt window when it's done, and wait for the Immediate window to say the export job is "Done."
+1. Open the application, hit CTRL-G, and run the following VB code in the Immediate window: "`ExportAllSource`". Wait for the Immediate window to say the export job is "Done."
2. Using your repository's tools, commit all the new files that were created in the source folder under `~/MyProject` . Use an appropriate commit message to describe your changes.
3. Pull new upstream changes (if any exist) from your central sharing location used by all developers. If necessary address any merge conflicts using your repository's merge and conflict resolution tools. If any work was done in this step, commit these changes to your local repository as well.
4. Push all local and merged changes back to the central sharing location.
-5. Go back into the Access Immediate window (CTRL-G) and run the following VB code: "`ImportAllSource`". Dismiss the popup command prompt window when it's done, and wait for the Immediate window to say the export job is "Done."
+5. Go back into the Access Immediate window (CTRL-G) and run the following VB code: "`ImportAllSource`". Wait for the Immediate window to say the export job is "Done."
Committing a New "Release" of Your Project
------------------------------------------
View
BIN demo/demo.accdb
Binary file not shown.

0 comments on commit e8e0c17

Please sign in to comment.