Trying to add VBA code to Access Database

farmerscott

Well-known Member
Joined
Jan 26, 2013
Messages
819
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I have just upgraded to Access as part of Office 365 (Windows 10 Pro).

Am trying to write a small piece of VBA code to update a calculated field (before I move to the next record).

1. I keep getting the following error- "Microsoft Visual Basic for Applications- File not found". Upon clicking the help button it takes me to File not found (Error 53).

2. Also where does the code go? In a module?

What am i missing?

thx.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
2. Also where does the code go? In a module?

What am i missing?

thx.

  1. In design view with the Form selected in the properties pane, click on the Events tab
  2. Click the white box next to Before Update
  3. Click the ellipsis (...)
  4. Select Code Builder
  5. The VBA window comes up to the before update sub; put your code in this sub
If you're trying to update the value on a calculated field by forcing a recalculation, the following code can do that:

VBA Code:
Me.Recalc
 
Upvote 0
farmerscott,

this is an excel forum. even though Jon has given an answer.
 
Last edited by a moderator:
Upvote 0
  1. In design view with the Form selected in the properties pane, click on the Events tab
  2. Click the white box next to Before Update
  3. Click the ellipsis (...)
  4. Select Code Builder
  5. The VBA window comes up to the before update sub; put your code in this sub
If you're trying to update the value on a calculated field by forcing a recalculation, the following code can do that:

VBA Code:
Me.Recalc
John,

After selecting the code builder (your step 4), I am still getting the error code.

thx
 
Upvote 0
Adam,

John is right, it is a subform. Maybe I should have mentioned it..........

However, I think this problem has to do with the general setup of Access. Maybe a missing library or add-in????

Points for having a go.

thx

Farmerscott
 
Upvote 0
scott,

I've worked with access since 1992 when version 1 came out. are you still having an issue with this? if Jon has disappeared, I might be able to shed some light on it....
 
Upvote 0
Adam,

I am all ears........

Will be away from the computer off and on for the next 12 hours, so I might not reply straight away.

thx

FS
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,210
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top