DataBase - Creating a table with all the "object dependancies"

Asked By DawnTreader
03-Feb-10 12:11 PM
Hello All

here is some code that i found then modified. i consider it to be a poor
mans object dependancies tool with out turning on the crap that came with
2003.

Public Sub queryDocumentation()
Dim db As Database
Dim qdf As QueryDef
Set db = CurrentDb
Dim tbl As TableDef

For Each tbl In db.TableDefs
'        DoCmd.RunSQL ("INSERT INTO mytblTablesInQueries (TableName) SELECT
'" & tbl.Name & "'")
For Each qdf In db.QueryDefs '.QueryDefs
If InStr(qdf.SQL, "" & tbl.Name & "") Then
DoCmd.RunSQL ("INSERT INTO mytblTablesInQueries (TableName,
QueryName) SELECT '" & tbl.Name & "', '" & qdf.Name & "'")
End If
Next qdf
Next tbl
End Sub

i am wondering if anyone can point me in the direction of what code i would
need to do the same for forms and reports. what i need to know is how to find
the "querydefs" for forms and reports. is there isomewhere that stores that
kind of information for a form and a report?

as always, any and all help appreciated
DoCmd.RunSQL
(1)
VBA
(1)
MytblTablesInQueries
(1)
OrderByOn
(1)
Database
(1)
Report
(1)
QueryName
(1)
TableName
(1)
  John W. Vinson replied to DawnTreader
03-Feb-10 06:48 PM
This is far from trivial. I use Total Access Analyzer form
http://www.fmsinc.com for the purpose, and I find it well worth the money.

The problem is that there are so MANY places to look. The Form or Report has a
Recordsource, which might be a tablename - or might be a multitable query,
which may well be based on some *other* query, which may...

They'll also have Filter and OrderBy properties which may well reference
fields... but that reference may well be immaterial if the FilterOn and
OrderByOn properties are False.

A form is also very likely to have one or more Subforms, which have all the
same issues.

A Form (or even a Report) may have one or more Combo Boxes or Listboxes, with
their own Rowsources - which again are likely to be Queries, possibly
multitable queries.

That does not even touch the fact that a form or report very likely will
contain VBA code, which could contain ANYTHING.

I would not even venture to try to tackle this job! If you are really top-notch
at VBA and are intimately familiar with the Access object model... go for
it... but bear in mind that the good folks at FMS are both, and AFAIK they are
still testing the 2007 version.
--

John W. Vinson [MVP]
  DawnTreader replied to John W. Vinson
04-Feb-10 11:25 AM
Hello John

see the thing is though if i know what is needed by my forms and reports
then the rest is trickle down information. if i know the "first" or "top"
level then i can follow down through the dependancies.

what i am trying to accomplish is to clear my databases of non implemented
feature creep orphan items.

can you tell me what the objects are? or at least where to look?
--
As always, any and all help appreciated! :)
  John W. Vinson replied to DawnTreader
04-Feb-10 01:13 PM
The Form's Recordsource property, each Subform's Form object's Recordsource
property, and each combo and listbox's RowSource property.

it is a monstrous job. It can be done but it is almost easier to make a copy of
the database, delete a query, and test everything and see what breaks. Or...
buy Total Access Analyzer.
--

John W. Vinson [MVP]
  David W. Fenton replied to DawnTreader
04-Feb-10 09:39 PM
Well, you might try temporarily turning on Name AutoCorrect. It will
calculate and display most of the dependencies for you, but it is not
100%. It does not look at modules, macros or menus/toolbars, but it
certainly takes care of tables, queries, forms and reports. One
thing, though -- you have to have the tables in the same database as
the front-end objects. I am working on a big project completely
revamping naming conventions on an existing application and I just
took my front end, deleted the linked tables and imported the
tables.

The problem is that you cannot do this on a live back end, so you will
still have to do any work on the data tables a second time.

On the other hand, if you are not renaming fields or anything, you
do not have to worry about that.

If you *are*, you might find the quick-and-dirty utility I made for
this useful. it is the first link on my Access downloads page:

http://dfenton.com/DFA/download/Access/

--
David W. Fenton                  http://www.dfenton.com/
usenet at dfenton dot com    http://www.dfenton.com/DFA/
Create New Account
help
Library Database DataBase Firstly, I am not sure if Library database is the correct term. I am talking about Dbs to which you set a reference in the VBA references section. Secondly apologies for sort-of reposting this question, but I drew blanks last time. Now assuming I have several referenced (library?) databases in my main database, how do I get the names of all the forms in all the Dbs? CodeProject AllForms.Count gives me the correct number of forms if I am in that referenced database. What I think I need is a method of looping through all the different CodeProject names in the main database, but there is not a sort of CodeProjects parent object. Or somehow moving the focus And, No, there is not any parent object for all the code projects. Because each database only knows about its own objects (or documents), you have to use a procedure in
Should I trust Martin Green's website DataBase I have come across www.fontstuff.com by Martin Green. He seems to be a like using SQL in the recordSource property of a form or using SQL from within VBA). I am inclined to send the website $10 for the free materials I have used there isome web site verifier that you know about? Thanks in advance. Strasser Access Discussions DoCmd.RunSQL (1) CurrentProject.Connection.Execute (1) VBA (1) Currentdb.Execute (1) Debug.Assert (1) Debug.Print (1) SQLRun (1) DbFailOnError (1) You irritates me. He used docmd.setwarnings which we should never, ever use. DoCmd.SetWarnings False DoCmd.RunSQL strSQL DoCmd.SetWarnings True The problem with DoCmd.RunSQL is that it ignores any errors. Either of the following will display any error
Dates in subform DataBase I need to make a Form where the user type: SampleID: 1234 StartDate: 01-01 accessmonster.com / Uwe / Forums.aspx / access-forms / 201002 / 1 Access Forms Discussions SQL Server (1) DoCmd.RunSQL (1) DoCmd.SetWarnings (1) Excel (1) SampleDueDateID (1) EveryMonthDate (1) EveryStartDate (1) Database (1) On this form there should be a subForm because in the subForm it will DateAdd("m", Me.CheckEvery, Me.StartDate) 'the first due date Do Until dtDue > Me.EndDate DoCmd.RunSQL "INSERT Into tablename ([SampleId], [DueDate]) Values (" & _ Me.SampleID & ", #" & dtDue & "#)" dtDue = DateAdd("m", Me.CheckEvery in Access and not Excel. This is just a small part of the Form and Database but a very necessary part. I know it can be done somehow in access I or anyone, You asked for more information. Right now I just made a simple test database: Database name: Sampledb Table name: tblSample [SampleID] [StartDate] [EndDate] [CheckEvery] Form name: frmSample I think
Too few paramters DataBase Can anyone advise why I am getting a 'Too few parameters - Expected 2' with these ImpDate) = [forms]![ProcessErr]![cmbImpDate]));" Any assistance would be greatly appreciated. . . Cheers, GT. Access Queries Discussions DoCmd.RunSQL (1) PermSrvcsIgnore.Server (1) DoCmd.SetWarnings (1) CurrentDb.Execute (1) Services.ImpDate (1) VBA (1) Services.Service (1) Services.Server (1) You are attempting to update two tables at Bicycle Builder. Hi Jerry, Thanks for your reply, maybe I should be doing this in VBA. What I am trying to acheive is this: I have one table (tbl01_Services) with a service will translate the SQL and take care of getting values of control references and vba expressions. If you build the SQL string in VBA, then you need to get the values and place them in the string. Also, I are probably using CurrentDb.Execute when it fails with the error you mentioned. Try using DoCmd.RunSQL instead. DoCmd.RunSQL, the User Interface, Dxxx functions (DLookup, DSum, . . . ), Recordset Control Source (for
Refresh unbound textbox DataBase Refresh unbound textbox Hello, Using Access = 9203 = 85 I have quite a bit of VBA code that runs a variety of queries. Between all of the SQL code, I display Me.unboundTextBox = 3D = 93About to run queries = 94 Me.unboundTextBox = 3D = 93Running Query A = 94 Docmd.runsql(queryA) Me.unboundTexBox = 3D = 93Running Query B = 94 Docmd.runsql(queryB) = 85 Me.unbountTextBox = 3D = 93Running Query Z = 94 Docmd.runsql(queryZ) Me.unboundTextBox = 3D = 93Finished queries = 94 End sub = 91 = 92 = 92 = 92 = 92 = 92