VBA Access - Documentando Objetos da Aplicação MS Access - Code Documenter
Autor: Brazil SFE | Publicado: 2016-12-15T04:21:00-08:00


VBA Access - Documentando Objetos da Aplicação MS Access - Code Documenter


Existem alguns aspectos desafiadores ao&nbsp;implementarmos os códigos em nossas aplicações MS Access. Mas ao olharmos para o projeto como um todo ainda nos cabe uma tarefa extremamente necessária:&nbsp;A DOCUMENTAÇÃO DA APLICAÇÃO.



Esta faz-se muito útil tanto&nbsp;quando precisamos voltar a aplicação para uma manutenção, como quando outros assumem futuras implementações.&nbsp;Tenham em mente que não é tempo perdido, incluam isso ao preparar seus apertadíssimos cronogramas.



Para que se inspirem a documentar todos os objetos da sua aplicação estou disponibilizando&nbsp;2 aspectos&nbsp;bem relevantes para documentarem:&nbsp;Todas as Tabelas&nbsp;e&nbsp;Queries.



Ao documentá-las terá uma boa compreensão de como sua aplicação se comporta, cabe a você extrapolar para:



Relatórios
Formulários
Scripts&nbsp;VBA&nbsp;(módulos&nbsp;e classes)
Macros



Conforme combinado, começo a brincadeira e vocês implementam o resto.



::&nbsp;Primeiro
Liste todas as tabelas da sua aplicação




Public Sub ListTables()&nbsp;&nbsp;&nbsp; ' Author:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Contact:&nbsp;&nbsp;&nbsp; ' André Bernardes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 09/09/2010 08:43&nbsp;&nbsp;&nbsp;brazilsalesforceeffectiveness@gmail.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Lista todas as tabelas da aplicação.&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; On Error Resume Next&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; For i = 0 To CurrentDb.TableDefs.Count - 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "Table: " &amp; CurrentDb.TableDefs(i).Name&nbsp;&nbsp;&nbsp; NextEnd Sub














::&nbsp;Segundo
Liste todas as queries da sua aplicação com alguns detalhes opcionais


&nbsp;Public Sub ListQueries()&nbsp;&nbsp;&nbsp; ' Author:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Contact:&nbsp;&nbsp;&nbsp; ' André Bernardes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 09/09/2010 10:05&nbsp;&nbsp;&nbsp;brazilsalesforceeffectiveness@gmail.com&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ' Lista todas as tabelas da aplicação.&nbsp;&nbsp;&nbsp;&nbsp; Dim i As Integer&nbsp;&nbsp;&nbsp; Dim j As Integer&nbsp;&nbsp;&nbsp; Dim k As Integer&nbsp;&nbsp;&nbsp; Dim l As Integer&nbsp;&nbsp;&nbsp;&nbsp; On Error Resume Next&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; For i = 0 To CurrentDb.QueryDefs.Count - 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "&nbsp;&nbsp;&nbsp; Query: " &amp; CurrentDb.QueryDefs(i).Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Opcionalmente pode-se acrescentar que se liste todos os campos:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'For j = 0 To CurrentDb.QueryDefs(i).Fields.Count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&nbsp;&nbsp;&nbsp; Debug.Print "Field " &amp; CurrentDb.QueryDefs(i).Fields(j).Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Opcionalmente pode-se listar todas as propriedades:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'For k = 0 To CurrentDb.QueryDefs(i).Fields.Count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&nbsp;&nbsp;&nbsp; Debug.Print "Propertie " &amp; k &amp; " - " &amp; CurrentDb.QueryDefs(i).Properties(k)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Next&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "Propertie: " &amp; CurrentDb.QueryDefs(i).Properties(16)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;SQL: " &amp; CurrentDb.QueryDefs(i).SQL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.Print " "&nbsp;&nbsp;&nbsp; NextEnd Sub




















Code Documenter


Retornem para comentar o que desenvolveram de novo!



Envie seus comentários&nbsp;e sugestões&nbsp;e compartilhe este artigo!



brazilsalesforceeffectiveness@gmail.com



&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;