subform textbox bordercolor

Jaye7

Registered User.
Local time
Tomorrow, 08:31
Joined
Aug 19, 2014
Messages
205
I am trying to highligh a subform textbox a yellow color on focus.
However it is highlighting every textbox in that field as it is a continuous form therefore they are all named ThisCount.
Is there a way to highlight just the specific textbox that I am in.

I have tried.

Code:
Me.ThisCount.BorderColor =RGB(255, 215, 0) 'gold
Me.ThisCount.BorderWidth =3

and tried

Code:
Dim ctlCurrentControl As Control
Dim strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
Set ctlCurrentControl = Screen.ActiveControl
  
ctlCurrentControl.BorderColor = RGB(255, 215, 0) 'gold
ctlCurrentControl.BorderWidth = 3
 
Hi Gemma, I have looked at conditional formatting but it doesn't work when you want an on focus event for a textbox (continuous form) when the values are yet to be entered into the textbox, it works based on different values in different records, so all of my textboxes are null when the form opens (for that field) so all are highlighted, which is what I don't want.
 
put an hidden field RecordPointer
put another hidden field at the Footer SelectedRecord

make RecordPointer RowSource =IIf([PK]=Me.SelectedRecord,"1","0")

Use the .OnCurrent event to requery RecordPointer

Now you can use the conditional formatting based on the RecordPointer
 
put an hidden field RecordPointer
put another hidden field at the Footer SelectedRecord

make RecordPointer RowSource =IIf([PK]=Me.SelectedRecord,"1","0")

Use the .OnCurrent event to requery RecordPointer

Now you can use the conditional formatting based on the RecordPointer

Really genius.
 
OK, so I finally got around to trying this.

I put a hidden field/ textbox named RecordPointer
I put another hidden field/textbox at the Footer named SelectedRecord

I put the controlsource of the textbox named RecordPointer as =IIf([PK]=Me.SelectedRecord,"1","0")

I set the .OnCurrent event of the form to requery RecordPointer.

the recordpointer fields have a name error in them

should there be another field named PK.

Do you have an example database that you could show me?.
 
Thanks for your help, much appreciated.
 

Users who are viewing this thread

Back
Top Bottom