Access.2007.VBA.Bibl..

(John Hannent) #1
Next qdf

rst.Close

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


strTable = “zstblQueryAndFieldNames”
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 = “zsrptQueryAndFieldNames”
DoCmd.OpenReport strReport
End If

ErrorHandlerExit:
Exit Function

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

End Function

List Table Fields ......................................................................................................


The ListTableFieldsfunction (called from the USysRegInfo table) lists the fields in all the
tables in the database, using the TableDefs collection of the DAO object model:


Public Function ListTableFields()
‘Called from USysRegInfo

On Error Resume Next

Call CopyListObjects
Set dbsCode = CodeDb
Set dbsCalling = CurrentDb

Creating Access Add-ins 14

Free download pdf