tonydemarco
asked on
Object List Module
I found the following question: https://www.experts-exchange.com/questions/20155738/Enumerate-list-all-objects-in-which-a-table-is-used.html?query=<span%20class=
Tried to use the code but I get a Run Time Error '13': Type mismatch.
When I debug I get the code line: Set rs = db.OpenRecordset("tblObjec
I am using MS ASSESS 2002 on Win2k
Help!
Try replacing dbOpenDynaset with the number 2 or 3
(Wild guess) In any code module, go to Tools menu:References, set a reference to 'Microsoft Data Access Objects Library' a.k.a. DAO, and run again.
ASKER
dds110, - 2 = same 3= invalid argument
jimhorn, - References already set
(Wild guess) Eyeball your references again and see if Microsoft ActiveX Data Objets, a.k.a. ADO is checked.
If it is, then you will want to differentiate your objects between DAO and ADO, as they both have a recordset object:
Dim db as DAO.Database
Set db = CurrentDb()
Dim rs as DAO.Recordset
Set rs = db.OpenRecordset (blah blah blah)
If it is, then you will want to differentiate your objects between DAO and ADO, as they both have a recordset object:
Dim db as DAO.Database
Set db = CurrentDb()
Dim rs as DAO.Recordset
Set rs = db.OpenRecordset (blah blah blah)
ASKER
jimhorn,
Microsoft ActiveX Data Objects 2.1 Library - checked
Made changes to code - same error.
Microsoft ActiveX Data Objects 2.1 Library - checked
Made changes to code - same error.
ASKER
cont'd
Public Sub ListObjects()
Dim db As DAO.Database, qdf As QueryDef, qdf2 As QueryDef, tdf As TableDef, rpt As Report, frm As Form, ctr As Container
Dim doc As Document
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblObjec tSpecs", dbOpenDynaset)
Public Sub ListObjects()
Dim db As DAO.Database, qdf As QueryDef, qdf2 As QueryDef, tdf As TableDef, rpt As Report, frm As Form, ctr As Container
Dim doc As Document
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblObjec
Try taking out the 2nd rs parameter alltogether and see what that gives ya
i.e.
Set rs = db.OpenRecordset("tblObjec tSpecs")
i.e.
Set rs = db.OpenRecordset("tblObjec
try this:
Set db = CurrentDb() '<== Delete the parantheses
Set rs = db.OpenRecordset("tblObjec
OR
Set db = CurrentDb() '<== Delete this line, and modify the next line
Set rs = CurrentDb.OpenRecordset("t
jaffer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks jjafferr,
That worked!
Can you tell me why the UsedbyName in the tblObjectSpecs looks like:
~sq_dprv_3BInvoiceJournal_ rpt1~sq_dp rv_3BState ment_subrp t
Where ~sq_d is the separator.
Can this be changed in the code to something more friendly?
That worked!
Can you tell me why the UsedbyName in the tblObjectSpecs looks like:
~sq_dprv_3BInvoiceJournal_
Where ~sq_d is the separator.
Can this be changed in the code to something more friendly?
Hi Tony
You are welcome, and
Thanks for the points and the grade.
Looking at my Table, I have the following, with my "assumed" interperetation:
~sq_f : Form
~sq_c : ComboBox/Listbox
~sq_d : I think, ComboBox/Listbox/SubForm/S ubReport which's Row Source is the same Table as the Record Source of the Form/Report
~sq_r : Report
so this:
~sq_dprv_3BInvoiceJournal_ rpt1~sq_dp rv_3BState ment_subrp t
means:
the Form/Report prv_3BInvoiceJournal_rpt1 contains a ComboBox/Listbox/SubForm/S ubReport called prv_3BStatement_subrpt which uses the same Row Source/Record Source of the main Form/Report.
Can this be captured from code and changed?
Yes, this way:
every place you find
rs!QueryName =
you will have to test it's result and assign the value accodingly, for example:
'rs!QueryName = rpt.RecordSource
Telda1=InStr(rpt.RecordSou rce, "~")
Telda2=InStr(2, rpt.RecordSource, "~")
if Telda1>0 and left( rpt.RecordSource ,5)="~sq_d" then
rs!QueryName = replace(rpt.RecordSource," ~sq_d", "This is a Data: ")
endif
if Telda1>0 and Telda2>0 then
...
endif
and so on
jaffer
You are welcome, and
Thanks for the points and the grade.
Looking at my Table, I have the following, with my "assumed" interperetation:
~sq_f : Form
~sq_c : ComboBox/Listbox
~sq_d : I think, ComboBox/Listbox/SubForm/S
~sq_r : Report
so this:
~sq_dprv_3BInvoiceJournal_
means:
the Form/Report prv_3BInvoiceJournal_rpt1 contains a ComboBox/Listbox/SubForm/S
Can this be captured from code and changed?
Yes, this way:
every place you find
rs!QueryName =
you will have to test it's result and assign the value accodingly, for example:
'rs!QueryName = rpt.RecordSource
Telda1=InStr(rpt.RecordSou
Telda2=InStr(2, rpt.RecordSource, "~")
if Telda1>0 and left( rpt.RecordSource ,5)="~sq_d" then
rs!QueryName = replace(rpt.RecordSource,"
endif
if Telda1>0 and Telda2>0 then
...
endif
and so on
jaffer
ASKER
Excellent!
Thanks
Thanks
Hey Tony,
I would be interested to see what you come with, if you don't mind :o)
jaffer
I would be interested to see what you come with, if you don't mind :o)
jaffer