Rabu, 21 Mei 2014

Re: [MS_AccessPros] Re: Hover Color in Command Button changes in MS2013 when form is imported

 

are you hoping to change all forms or just the open forms?  This changed all forms, if that is what you are looking for.

Public Sub ChangeHooverColorAllForms()
On Error GoTo ChangeHoverColorAllForms_Error
  Dim aofrm As Access.AccessObject
  Dim Frm As Access.Form
  Dim Frms1 As Variant
  Dim ctl As Control

  For Each aofrm In CurrentProject.AllForms         'Loop all the forms
        DoCmd.OpenForm aofrm.Name, acDesign, , , , acHidden
        Set Frm = Forms(aofrm.Name)
        For Each ctl In Frm.Controls
          If ctl.ControlType = acCommandButton Then
              If ctl.HoverColor = 16777215 Then
                 ctl.HoverColor = RGB(0, 0, 255)
              End If
           End If
        Next ctl
        DoCmd.Close acForm, Frm.Name, acSaveYes
  Next aofrm
On Error GoTo 0
Exit Sub
ChangeHoverColorAllForms_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ChangeHoverColorAllForms of Module ModTools"
End Sub


On Wed, May 21, 2014 at 3:30 PM, wrmosca@comcast.net [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
 

Hi Norbert


Your code looks right to me. Did you try creating a new form to see what the HoverColor was?

-Bill


---In MS_Access_Professionals@yahoogroups.com, <drnorbert@msn.com> wrote :


Hi Bill,

Sorry for the delay,

Yes I am opening the form in design view and loop for each control and of course select acCommandButton only and also have an If condition to just change the color if found only  #FFFFFF.

here is the code:

'---------------------------------------------------------------------------------------
' Procedure : ChangeHoverColorAllForms1
' Author    : norbert
' Date      : 5/19/2014
' Purpose   :
'---------------------------------------------------------------------------------------
'
Public Sub ChangeHooverColorAllForms()
On Error GoTo ChangeHoverColorAllForms_Error
Dim DbF As Form
Dim DbO As Object
Dim Frms As Variant
Dim Frms1 As Variant
Dim ctl As Control

Set DbO = Application.Forms 'Collection of all the open forms

For Each DbF In DbO         'Loop all the forms
        DoCmd.OpenForm DbF.Name, acDesign
        For Each ctl In DbF.Controls
            If ctl.ControlType = acCommandButton Then
                    'MsgBox ctl.Name
                    If ctl.HoverColor = 16777215 Then
                        ctl.HoverColor = RGB(0, 0, 255)
                    End If
            End If
        Next ctl
        DoCmd.Close acForm, DbF.Name, acSaveYes
Next DbF
On Error GoTo 0
Exit Sub
ChangeHoverColorAllForms_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ChangeHoverColorAllForms of Module ModTools"
End Sub


Please let me know of any other suggestions.

Thanks a lot

Norbert


__._,_.___

Posted by: Peter Poppe <plpoppe@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (14)

.

__,_._,___

Tidak ada komentar:

Posting Komentar