Prikazi cijelu temu 11.09.2012 11:56
roko Van mreze
Clan
Registrovan od:02.02.2009
Lokacija:Rijeka


Predmet:Re: Nekorišteni objekti
evo ti dve funkcije mislim da če ti dati podatke jedino je problem ako na nekoj formi koristiš unbound objekte ...
ipak dobiješ listu pa vidi

f1
Public Function SkupiResurse() As String
Dim frm As AccessObject
Dim rpt As AccessObject
Dim ctl As Access.Control
SkupiResurse = "Forms" & vbCrLf & vbCrLf
For Each frm In CurrentProject.AllForms
DoCmd.OpenForm frm.Name, acDesign, , , , acHidden
SkupiResurse = SkupiResurse & frm.Name & vbCrLf & "Recordsource:" & Forms(frm.Name).RecordSource & vbCrLf
For Each ctl In Forms(frm.Name).Controls
If ctl.ControlType = acListBox Or ctl.ControlType = acComboBox Then
SkupiResurse = SkupiResurse & ctl.Name & " RowSource: " & ctl.RowSource
End If
Next ctl
SkupiResurse = SkupiResurse & vbCrLf
DoCmd.Close acForm, frm.Name
Next frm
SkupiResurse = SkupiResurse & "Reports" & vbCrLf & vbCrLf
For Each rpt In CurrentProject.AllReports
DoCmd.OpenReport rpt.Name, acViewDesign, , , acHidden
SkupiResurse = SkupiResurse & rpt.Name & vbCrLf & "Recordsource:" & Reports(rpt.Name).RecordSource & vbCrLf
For Each ctl In Reports(rpt.Name).Controls
If ctl.ControlType = acListBox Or ctl.ControlType = acComboBox Then
SkupiResurse = SkupiResurse & ctl.Name & " RowSource: " & ctl.RowSource
End If
Next ctl
SkupiResurse = SkupiResurse & vbCrLf
DoCmd.Close acReport, rpt.Name
Next rpt
End Function

Public Function getRecordsource() As String
Dim frm As AccessObject
Dim rpt As AccessObject
getRecordsource = "Forms" & vbCrLf & vbCrLf
For Each frm In CurrentProject.AllForms
DoCmd.OpenForm frm.Name, acDesign, , , , acHidden
If Not Forms(frm.Name).RecordSource = "" Then
getRecordsource = getRecordsource & frm.Name & vbCrLf & "Recordsource:" & Forms(frm.Name).RecordSource & vbCrLf & vbCrLf
End If
DoCmd.Close acForm, frm.Name
Next frm
getRecordsource = getRecordsource & "Reports" & vbCrLf & vbCrLf
For Each rpt In CurrentProject.AllReports
DoCmd.OpenReport rpt.Name, acViewDesign, , , acHidden
If Not Reports(rpt.Name).RecordSource = "" Then
getRecordsource = getRecordsource & rpt.Name & vbCrLf & "Recordsource:" & Reports(rpt.Name).RecordSource & vbCrLf & vbCrLf
End If
DoCmd.Close acReport, rpt.Name
Next rpt
End Function

'' pozovi ih
Dim s As String
s = getRecordsource
MsgBox (s)
s = SkupiResurse
MsgBox (s)