A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

cmdButton Not refreshing in OnChange event in Split form



 
 
Thread Tools Display Modes
  #1  
Old March 16th, 2009, 06:59 PM posted to microsoft.public.access.forms
-james
external usenet poster
 
Posts: 4
Default cmdButton Not refreshing in OnChange event in Split form

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.

  #2  
Old March 16th, 2009, 07:04 PM posted to microsoft.public.access.forms
-james
external usenet poster
 
Posts: 4
Default cmdButton Not refreshing in OnChange event in Split form

Sorry, I should have mentioned this is Access 2007.

"-james" wrote:

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.

  #3  
Old March 16th, 2009, 10:43 PM posted to microsoft.public.access.forms
-james
external usenet poster
 
Posts: 4
Default cmdButton Not refreshing in OnChange event in Split form

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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.