By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,986 Members | 1,522 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,986 IT Pros & Developers. It's quick & easy.

VBA code won't run in Access 2007

P: 1
Hello. I've programmed before in VB 6 and .NET and I've always used this very simple code and it usually works. For some reason I try it in VBA 2007 with Access and it doesn't execute. I've set one of my txtfields to disabled and now I'm trying to enable it through code. This is what I've written.

Expand|Select|Wrap|Line Numbers
  1. Private sub txtMethodPayment_BeforeUpdate ()
  2. If txtMethodPayment = "Cheque" Then
  3.   txtCheqNum.Enabled = True 
  4. End if
  5. End Sub
I've tried inserting the same code under the LostFocus tab, I tried creating a command button and adding on click code, nothing executes. It just saves to the table and ignores whatever I wrote. I tried doing the same code in VBA access 2003 it was fine.
Dec 24 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 8,434
One thing I do remember about Access is that you have to indicate in the control's properties whether it is to run an "action" or a macro or a VBA routine for the event. It's not like "real" VB where you just write the code and it's automatically "attached" to the control.
Dec 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.