Share via

Runtime Error 2465

Anonymous
2011-02-06T11:24:31+00:00

I'm trying to set the FontName of the list boxes that I have on several of my forms by calling a public function from the OnLoad of my forms.

The following code is recieving a "Run-time error 2465: Application-defined or object-defined error"

Public Function ListBoxProperties(frm As Form)

     Dim ctl As Control

     For Each ctl In frm.Controls

         If frm.ControlType = acListBox Then

            ctl.FontName = "Arial"

         End If

     Next ctl

End Function

The For Each line is being highlighted. The forms contain only 1 listbox. I'm callong the finction form the OnLoad- Call ListBoxProperties(Me)

James

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-02-06T18:42:23+00:00

Public Sub ListBoxProperties(frm As Form)

    Dim ctl As Control

     For Each ctl In frm.Controls

         If ctl.ControlType = acListBox Then

            ctl.FontName = "Arial"

         End If

     Next ctl

End Sub


Cheers, Jörn Bosse

Microsoft Studentpartner

Was this answer helpful?

0 comments No comments

14 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-02-06T19:03:53+00:00

    finally we made it :D


    Cheers, Jörn Bosse

    Microsoft Studentpartner

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-02-06T18:53:27+00:00

    Yeah. I eliminated the 'Set frm' line and it appears to be working fine now.

    Thanks much,

    James

    Was this answer helpful?

    0 comments No comments