[AccessD] For all forms
jack drawbridge
jackandpat.d at gmail.com
Wed Aug 4 20:19:49 CDT 2021
Hi Arthur,
Here's a working function I created and tested. It's based on comments from
Gustav and Ryan.
I am limiting the output to those forms that have a combo and/or listbox. I
sent a copy to you directly as well.
Procedure Name: ComboAndListboxOnForms
' Purpose: For forms in database where exists a combobox and/or listbox,
' print formname, controlname and rowsource
' Procedure Kind: Sub
' Procedure Access: Public
' Author: Jack
' Date: 04-Aug-21
' ----------------------------------------------------------------
Sub ComboAndListboxOnForms()
10 On Error GoTo ComboAndListboxOnForms_Error
Dim obj As AccessObject, dbs As Object
Dim ctrl As Control
20 Set dbs = Application.CurrentProject
30 For Each obj In dbs.AllForms
40 DoCmd.OpenForm obj.name, acDesign, , , , acHidden
50 For Each ctrl In Forms(obj.name).Controls
60 Select Case ctrl.ControlType
Case acComboBox, acListBox
70 Debug.Print obj.name & "....." & ctrl.name & "
" & ctrl.RowSource
80 End Select
90 Next ctrl
100 DoCmd.Close acForm, obj.name
110 Next obj
120 On Error GoTo 0
ComboAndListboxOnForms_Exit:
130 Exit Sub
ComboAndListboxOnForms_Error:
140 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure ComboAndListboxOnForms, line " & Erl & "."
150 GoTo ComboAndListboxOnForms_Exit
End Sub
A few examples of output:
frmMumbles10.....Combo4 "<";">";"=";"<>"
frmProduct.....Combo2 (All);"green";"blue";"black"
frmTina.....Combo0 SELECT [tblTinaDates].[PUDate] FROM tblTinaDates
ORDER BY [PUDate];
frmTina.....Combo2 SELECT [tblHouseholds].[Owner] FROM tblHouseholds
ORDER BY [Owner];
Hope it's helpful.
jack
On Wed, Aug 4, 2021 at 6:27 PM Arthur Fuller <fuller.artful at gmail.com>
wrote:
> I am still getting used to my phone. I started a thread about iterating
> all forms and the controls within them. S one (Ryan?) posted a working
> procedure but now it is in my Read box and all I can see are Unread
> .messages. Could someone re-post it?
> Thanks.
>
>
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list