beforeupdate command not working in Access 2007

Y

Yvette

I have the following module which works in Access 2003 and is not working in
Access 2007. Is there something else I need to do now in this newer version
of Access for it to work? Thank you.

Form_Detailed Project Listing
Option Compare Database
Private Sub Form_BeforeUpdate (Cancel As Integer)
If Nz(Me.BalanceForward, 0) = 0 Then
Me.BalanceForward = Nz(Me.Final_Cap, 0) - Nz(Me.ApprovedCap, 0)
Else
Me.Final_Cap = Nz(Me.ApprovedCap, 0) + Nz(BalanceForward, 0)
End If
End Sub
 
D

Dirk Goldgar

Yvette said:
I have the following module which works in Access 2003 and is not working
in
Access 2007. Is there something else I need to do now in this newer
version
of Access for it to work? Thank you.

Form_Detailed Project Listing
Option Compare Database
Private Sub Form_BeforeUpdate (Cancel As Integer)
If Nz(Me.BalanceForward, 0) = 0 Then
Me.BalanceForward = Nz(Me.Final_Cap, 0) - Nz(Me.ApprovedCap, 0)
Else
Me.Final_Cap = Nz(Me.ApprovedCap, 0) + Nz(BalanceForward, 0)
End If
End Sub


In what way is it not working? Error message? Incorrect results? Nothing
happens?

Is VBA code enabled in the database? If the database is not in a trusted
location, you probably have to explicitly enable VBA code if you want it to
run at all.
 
Y

Yvette

Dirk Goldgar said:
In what way is it not working? Error message? Incorrect results? Nothing
happens?

Is VBA code enabled in the database? If the database is not in a trusted
location, you probably have to explicitly enable VBA code if you want it to
run at all.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Hello Dirk,
Thank you for responding. Nothing is happening. I am running off a
desktop's local drive. Perhaps I will need to (as you suggested) enable VBA
code to run it. How do I do that?

Thannk you.
Yvette
 
D

Dirk Goldgar

Yvette said:
Nothing is happening. I am running off a
desktop's local drive. Perhaps I will need to (as you suggested) enable
VBA
code to run it. How do I do that?

Normally you'd get a message when you open the database, asking you if you
want to enable the code (or something like that -- it may say "macros", I
don't remember). However, once you've answered that question in the
negative once, I'm not sure it would ask you again.

Try moving the database to your personal Documents folder, and then go into
Trust Center and set that folder as a Trusted Location, if it isn't already.
 
Y

Yvette

Thank you Dirk and Dale for your help. The database is working fine now.
Have a great Memorial day weekend!

Dale_Fye via AccessMonster.com said:
in 2007, you should see a security warning message located right below the
ribbon bar and above the Navigation Pane, if your application contains VBA
code and the application does not reside in a trusted location. Click the
Option button next to that Warning, then click on the "Enable this content"
radio button and click OK.

Alternately, you could click the "Open the Trust Center" text at the bottom
left of the Security Options dialog and add the folder that your application
is in to the trusted locations list.

HTH
Dale
I have the following module which works in Access 2003 and is not working
in
[quoted text clipped - 18 lines]
location, you probably have to explicitly enable VBA code if you want it to
run at all.

Thank you for responding. Nothing is happening. I am running off a
desktop's local drive. Perhaps I will need to (as you suggested) enable VBA
code to run it. How do I do that?

Thannk you.
Yvette

--
HTH

Dale Fye

Message posted via AccessMonster.com
 

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