Button on a continuous form.

SpiritedAway

Registered User.
Local time
Today, 11:12
Joined
Sep 17, 2009
Messages
97
Hi,

I have a continuous form with a button 'Cmd1' & a textbox 'txtMail' which is set to visible no.

When the user clicks Cmd1 - then txtMail becomes visible.

I can do it using vba on the buttons click event but when it executes txtMail for all the records become visible.

How do I use a button's click event on the form's current record - Private Sub Form_Current() so that when the user clicks Cmd1 on the current record only txtMail for that record becomes visible.

Any help would be appreciated. I'm using Access 2007.
 
.Visible is tricky with Continuous Forms, but I think you can set foreground/background color in Form_Current to accomplish approximately the same thing, and it will only affect the current record.

Someone else may have a better idea.
 
Look at Conditional formatting.

You will have do some searching but I think that this is your solution.
 
Just out of interest how would you write a button's click event into a form's current record in vba?

Private Sub Form_Current()

Cmd1_Click
Me.txtMail.Visible = True

End Sub

Is there a way of doing that?
 
To start, change the name of the Button to something more meaningful.

Then go to the properties in design and find the On Click Event.
 
controls on a continuous form will perform the same operation regardless of which record they are on...what you need to do is build in to the on-click event a conditional email event...i.e email record with ID=Me!ID.....it will only see one id and that will be the current record......maybe?????
 
I use textboxes made to look like buttons on Continuous Forms. Set their SpecialEffect to Raised. Put their "caption" in the Default property or use a ControlSource = "somestring"

Conditional Formatting can be used to Enable/Disable the textbox based on expressions in the conditions. The forecolor and backcolor can also be changed to make the textbox grey out like a disabled button.

In the on click event I change the SpecialEffect from Raised to Lowered and back after a short pause. This provides feedback that simulates the button being pressed.

It should make all the "buttons" on the Continuous Form appear to be pressed and this is what happened in Access 2007. However I recently found in Access 2010 on a newer computer that only the one button appears to move if the pause time is short enough. This is apparently only a fortuitous artefact of the display.

Take the focus to another control at the end of the event procedure to stop the textbox getting its displayed value highlighted.
 

Users who are viewing this thread

Back
Top Bottom