Change Color for ALL forms when Key Pressed

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Change Color for ALL forms when Key Pressed

Post by burrina »

I want to call a function that will work on all forms in the database. If a key is pressed while on a form then I want to change the border color of that form. I could of course use this for other purposes as well. I know it is not correct but this is as far as I have gone.

Code: Select all

Function frmColor(frmColor As String)

Dim f As Form
Dim i As Integer
Dim fcolor As String

fcolor = f
For i = 0 To Currentroject.AllForms.Count -1
Set f = Forms(i)


'KeyPress = True  'needed or not ?
'KeyCode = 0      'needed or not ?

Select Case x

Case 0-9

vbKey0, vbKey1, vbKey2, vbKey3, vbKey4, vbKey5, vbKey6, vbKey7, vbKey8, vbKey9 
fcolor.BorderColor = vbRed 
fcolor.BorderWidth = 2 

Case Else
'do nothing
End Select

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Change Color for ALL forms when Key Pressed

Post by burrina »

Okay, I found a workaround solution to the task.
Thanks

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: Change Color for ALL forms when Key Pressed

Post by burrina »

FYI, I simply used the OnLoadEent and AfterUpdateEvent to change my form design. The rule is KISS, I have a problem with that rule.