Subform reference each row event

naminder

Registered User.
Local time
Today, 14:52
Joined
Aug 8, 2005
Messages
41
I have tried and searched as much as i can.

I have a continous subform, a text box which has a date.

For each row i want a button to be visible where the date is blank. If the date is filled in No button. So i thought need an event. But where?

Can you reference row values?

Here's the code, where would it go?

If txtEndDate = Null Then
cmdCheckout.Visible = True
Else
cmdCheckout.Visible = False
End If
 
Put the code in the subform OnCurrent event, that is, every time focus moves to a new record, run the code.

Of course, if the button is not also on the subform, you have to change the code referencing it. I put it above the subform date column.
 
If you're displaying on one continuous form record at a time

Because of the way continuous forms work, the method you are using will cause all rows to show the button or hide it based on the criteria of the current row.

doesn't matter. OnCurrent will dislay it correctly.

If you're displaying multiple continuous form records simultaneously, put the button in the header or footer section of the form. The OnCurrent event will likewise display it correctly, depending on which record has focus.

I use if
If Me!txtEndDate & "" = "" then
to test for a Null.

If you have the button on each record and display multiple continuous form records simultaneously, change the button to a raised textbox, which you sink on GotFocus, raise and LostFocus, and use Conditional Formating to change the fore & back color to appear hidden on the subject condition. Use the Expression '([txtEndDate]&""="")', without the tic marks as the conditional expression. The sinking and raising of the textbox makes it act substantially like a button; the principal different being the spacing of any displayed text.
 
Pat Hartman said:
2. Because of the way continuous forms work, the method you are using will cause all rows to show the button or hide it based on the criteria of the current row. You will need to use the continuous format feature. Play around with it and see what you can do.

What is the "continuous format" feature?
 

Users who are viewing this thread

Back
Top Bottom