Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export all code in database

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
Can anyone modify the following module to include all code ie forms, reports and modules code. As it is it only exports the module code.

Function OutPutModules(strMyloc As Variant)
On Error GoTo OutPutModules_Error

Dim strMyMsg As String
Dim strMyTitle As String
Dim DB As DAO.Database
Dim strModuleName As String
Dim intI As Integer
Dim mdl As Module
Dim strMyExt As String
Dim strDisplayError As String
Dim strNewMsg As String
Dim strNewLoc As String

Set DB = CurrentDb()
' If user enters the backslash in the location, for example, 'A:\',
' parse out the '\' backslash, assign the drive letter and the colon
' ONLY to variable 'Myloc'.
If Right(strMyloc, 1) = "\" Then strMyloc = Left(strMyloc, _
Len(strMyloc) - 1)
strMyExt = ".txt" ' Set extension for file names.
' Loop through module names.
For intI = 0 To DB.Containers("Modules").Documents.Count - 1
' Set string variable(strModuleName) to module names.
strModuleName = DB.Containers("Modules").Documents(intI).Name
' Print out ALL modules in designated format to designated
' drive/folder.
strNewLoc = strMyloc & "\" & strModuleName & strMyExt
DoCmd.OutputTo acOutputModule, strModuleName, acFormatTXT, _
strNewLoc, 0
Next intI
' Display message with # of objects exported.
strNewMsg = intI & " Module Objects Exported" & Chr(13) & Chr(10)
strNewMsg = strNewMsg & "to " & strMyloc & "."
MsgBox strNewMsg, vbOKOnly, "Export Objects"

Exit_OutPutModules:
Exit Function

OutPutModules_Error:
Set mdl = Modules(strModuleName)
strMyTitle = "Error in Procedure: OutPutTo ; Module: " & mdl
strMyMsg = "Error Number: " & Err.Number & Chr(13) & Chr(10)
strMyMsg = strMyMsg & "Error Description :" & Err.Description & _
Chr(13) & Chr(10)
MsgBox strMyMsg, vbExclamation, strMyTitle
Resume Exit_OutPutModules
End Function
 
built into accees is the ability to document the db ..... so the question is why?

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work" <<Edison>>
 
Hi Patricia,

check out the code in my FAQ: faq705-4683

Hope this helps.

MakeItSo

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top