cmdButton Not refreshing in OnChange event in Split form

J

-james

I have a split form with a command button on it called btnCloseBatch. I want
the button to be enabled when the BatchStatus is Open and Disabled when the
BatchStatus is closed. Using the form's Curent Event I've added code like:

Private Sub Form_Current()

if Me!BatchStatus = "Open" Then
btnCloseBatch.Enabled = True
Else
BtncloseBatch.Enabled = False
End if

End Sub

When you tab through the fields on the form the Button displays as expected.
However, if you use your mouse and click on a record in the Split window and
make it the current record, the button does not display as expected. If you
move the mouse over the button it will repaint correctly.

How do I get the button to apear correctly in the Form_Current Event?

Before you suggest using Repaint, it doesn't fix the problem.

thanks in advance for your reply.
 
J

-james

Okay,

Not sure why it did not work before , but Me.Refresh works. After doing some
digging I tried it again, and now the form is updating correctly when you
click on a Split form line item.

-james

The resulting code resembles:

Private Sub Form_Current()

if Me!BatchStatus = "Open" Then
btnCloseBatch.Enabled = True
Else
BtncloseBatch.Enabled = False
End if

Me.Refresh

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top