continuous form event affecting all records instead of one

jillrein

Registered User.
Local time
Today, 15:33
Joined
Apr 19, 2008
Messages
28
I have a continuous form and want to hide or display another field depending on the value. The problem is it changes for all records in the form instead of just the current record.

I am using the following code.

Private Sub Check23_Click()
Me.[end date].Visible = Me.Check23
End Sub

I would be very grateful if someone can tell me what I am doing wrong.
 
Hi. Unfortunately, this is the normal behavior with continuous forms because there's really only one control (the current one) you can manipuate using code. To affect rows other than the current record, you can use Conditional Formatting (although it's limited to what you can do with it). To hide data using CF, you can set the ForeColor the same as the BackColor. Hope that helps...
 
Thank you for your help. However, the problem I am having is that the [end date] field is visible or hidden for all five rows simultaneously instead of the one just the one where the checkbox is changed.
 
Thank you for your help. However, the problem I am having is that the [end date] field is visible or hidden for all five rows simultaneously instead of the one just the one where the checkbox is changed.
Hi. Like I said, that is the expected behavior when you use code (VBA). You can only use Conditional Formatting with Continuous Forms. Either that or use some other technique like modifying the content of the field based on the checkbox. This means using something like an IIf() expression in the query source for your form.
 
Follow what DBGuy is saying. Read carefully. Only can be done with conditional formatting.
 

Attachments

Thank you both. Now I understand what you are saying.
 

Users who are viewing this thread

Back
Top Bottom