I have a main form with a command button.
This button opens a small pop-up form.
I make changes to data on the pop-up form and then close it to return to the main form.
I then check to see if a particular value has changed from the pop-up form. If it has, using conditional formatting, I change the colour of an unbound control to green, otherwise the control's fore and background colours remain the same as the form - ie invisible.
The result is that as a user selects records, if a value has been set via the pop-up form, a "little green light" will appear on the main form.
This all works perfectly with one minor glitch. It would be nice if, the "green light" would come on when the user closed the pop-up form. Unfornunately this only happens when moving to another record and then returning.
I have tried the following Form events to trigger a check of the data and a DoCmd.Requery but nothing seems to work:
Active
GotFocus
Current
Tried code is shown below:
Private Sub Form_Activate()
Dim varCES As Variant
varCES = DLookup("Completed", "tblCESLog", "[ID]= '" & [ID] & "'")
If varCES = -1 Then
Me!CESComplete = "Completed"
Else
Me!CESComplete = Null
End If
DoCmd.Requery
End Sub
The control "CESComplete" has the conditional formatting attached to it.
None seem to work. The Form "Load" and "Current" events work when moving from one record to another but none of them seem to work when closing the pop-up form to give focus back to the main form.
Nigel.
This button opens a small pop-up form.
I make changes to data on the pop-up form and then close it to return to the main form.
I then check to see if a particular value has changed from the pop-up form. If it has, using conditional formatting, I change the colour of an unbound control to green, otherwise the control's fore and background colours remain the same as the form - ie invisible.
The result is that as a user selects records, if a value has been set via the pop-up form, a "little green light" will appear on the main form.
This all works perfectly with one minor glitch. It would be nice if, the "green light" would come on when the user closed the pop-up form. Unfornunately this only happens when moving to another record and then returning.
I have tried the following Form events to trigger a check of the data and a DoCmd.Requery but nothing seems to work:
Active
GotFocus
Current
Tried code is shown below:
Private Sub Form_Activate()
Dim varCES As Variant
varCES = DLookup("Completed", "tblCESLog", "[ID]= '" & [ID] & "'")
If varCES = -1 Then
Me!CESComplete = "Completed"
Else
Me!CESComplete = Null
End If
DoCmd.Requery
End Sub
The control "CESComplete" has the conditional formatting attached to it.
None seem to work. The Form "Load" and "Current" events work when moving from one record to another but none of them seem to work when closing the pop-up form to give focus back to the main form.
Nigel.