OK i have a Microsoft access 2007 and i go VBA through it. What i need is, when I press a button, it should do some calculations and then disable the button. Its like when you click it, you can click the button only once and if you click one more time the data calculated would be wrong. I tried the following code first. Itm_balance and Squantity are field names.
Private Sub Command18_Click()
MsgBox "Do not click this button anymore!"
Itm_balance = Itm_balance - SQuantity
Command18.Enabled = False
End Sub
When i tried it, it gave an error message saying "Run-time error 2164, You can't disable a control while it has focus"
Can you help me to resolve this error?? You can ask more about my database also if you want. :D