BasExtras Module

The basExtras standard module contains functions that are called from the USysRegInfo table:

Public Function ExtrasOptions() 'Called from USysReglnfo (menu add-in)

On Error GoTo ErrorHandler

Dim strBackEndSyntaxChoice As String Dim strBackEndSyntax As String Dim strBackEndPathChoice As String Dim strBackEndPath As String Dim strDefault As String

Get info from database properties in the calling database, and write them to zstblBackupChoices in the code database for use as form's record source:

Set dbsCalling = CurrentDb strPropName = "BackupChoice" strDefault = "2"

strBackupChoice = GetProperty(strPropName, strDefault) Debug.Print "Backup choice: " & strBackupChoice strPropName = "BackupPath" strDefault = ""

strBackupPath = GetProperty(strPropName, strDefault) Debug.Print "Backup path: " & strBackupPath strTable = "zstblBackupChoice" Set dbsCode = CodeDb

Set rst = dbsCode.OpenRecordset(strTable)

rst.MoveFirst rst.Edit rst![BackupChoice] = strBackupChoice rst![BackupPath] = strBackupPath rst.Update rst.Close

On Error Resume Next

Copy the zstblBackupInfo table to the calling database, if needed:

strCallingDb = CurrentDb.Name strTable = "zstblBackupInfo" Set tdfsCalling = dbsCalling.TableDefs Set tdfCalling = tdfsCalling(strTable) If tdfCalling Is Nothing Then

Debug.Print strTable & " not found; about to copy it" DoCmd.CopyObject destinationdatabase:=strCallingDb, _ newname:=strTable, _ sourceobjectType:=acTable, _ sourceobjectname:=strTable Debug.Print "Copied " & strTable End If

Open the dialog form for selecting options:

strForm = "fdlgSetExtrasOptions" DoCmd.OpenForm FormName:=strForm, _ view:=acNormal, _ windowmode:=acDialog

ErrorHandlerExit: Exit Function

ErrorHandler:

& "; Description: " & err.Description Resume ErrorHandlerExit

End Function

Public Function CopyListObjects()

'Called from listTableFields() and ListQueryFields()

On Error Resume Next

Dim ctr As DAO.Container Dim doc As DAO.Document

Copy various objects to the calling database, if they don't already exist. These objects are needed to support the add-in's functionality:

Set dbsCalling = CurrentDb strCallingDb = CurrentDb.Name

Set tdfsCalling = dbsCalling.TableDefs strTable = "zstblAccessDataTypes"

Set tdfCalling = tdfsCalling(strTable)

DoCmd.SetWarnings False

If tdfCalling Is Nothing Then

Debug.Print strTable & " not found; about to copy it" DoCmd.CopyObject destinationdatabase:=strCallingDb, _ newname:=strTable, _ sourceobjectType:=acTable, _ sourceobjectname:=strTable

End If

Set ctr = dbsCalling.Containers("Reports") strReport = "zsrptTableAndFieldNames" Set doc = ctr.Documents(strReport) If doc Is Nothing Then

DoCmd.CopyObject destinationdatabase:=strCallingDb, _ newname:=strReport, _ sourceobjectType:=acReport, _ sourceobjectname:=strReport

End If strReport = "zsrptQueryAndFieldNames" Set doc = ctr.Documents(strReport) If doc Is Nothing Then

DoCmd.CopyObject destinationdatabase:=strCallingDb, _ newname:=strReport, _ sourceobjectType:=acReport, _ sourceobjectname:=strReport

End If

ErrorHandlerExit: Exit Function

ErrorHandler:

& "; Description: " & err.Description Resume ErrorHandlerExit

End Function

0 0

Post a comment