Access.2007.VBA.Bibl..

(John Hannent) #1

Copy the filled table to the calling database so it will be available for printing in the calling database:


strTable = “zstblTableAndFieldNames”
Set tdfCode = dbsCode.TableDefs(strTable)
DoCmd.CopyObject destinationdatabase:=strCallingDb, _
newname:=strTable, _
sourceobjectType:=acTable, _
sourceobjectname:=strTable

DoCmd.OpenTable strTable

strTitle = “Table filled”
strPrompt = “Print report now?”
intReturn = MsgBox(strPrompt, vbQuestion + vbYesNo, _
strTitle)
If intReturn = vbYes Then
strReport = “zsrptTableAndFieldNames”
DoCmd.OpenReport strReport
End If

ErrorHandlerExit:
Exit Function

ErrorHandler:
MsgBox “Error No: “ & err.Number _
& “; Description: “ & err.Description
Resume ErrorHandlerExit

End Function

Other Procedures ....................................................................................................


The SetPropertyand GetPropertyfunctions are called from various procedures in the add-
in to save values to custom database properties, or retrieve values from them:


Public Sub SetProperty(strName As String, lngType As Long, _
varValue As Variant)
‘Called from various procedures

On Error GoTo ErrorHandler

Attempt to set the specified property:


Set dbsCalling = CurrentDb
Set prps = dbsCalling.Properties
prps(strName) = varValue

ErrorHandlerExit:
Exit Sub

Creating Access Add-ins 14

Free download pdf