Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I run the program? 2

Status
Not open for further replies.

Kurt6905

Technical User
Aug 21, 2006
14
0
0
US
I have a question for any VB expert out there. The following module written for Access 97 and viewers in this forum are satisfied with the language. However, at the Module tab (displaying the Run, Design, New buttons) the Run button is shaded and cannot be clicked. What do I have to do to the program so the Run button is usable?

(The table is named Structural 2005. The fields Amount, Units, and Formulation are used to calculate the field Active. All Amounts are entered. I want to use this module to calculate Active for every record in one sweep - as a stand-alone program, so to speak.)


Option Compare Database
Option Explicit

Function DoTheUpdates()
docmd.set warnings false

DoCmd.RunSQL "update [Structural 2005] set Active = Amount * 8.35 * Formulation * 0.01 where Units= 'GAL'"

DoCmd.RunSQL "update [Structural 2005] set Active = Amount/16 * Formulation * 0.01 where Units= 'OZ'"

DoCmd.RunSQL "update [Structural 2005] set Active = Amount * Formulation * 0.01 where Units= 'LBS'"

docmd.set warnings true
End Function

Thanks for any assistance!

 
Kurt6905,
make a form & put a button on it to call the code or how about in the vba editor select run -> run sub/user form or how bout the f5 key while in the vba editor.
regards,
longhair
 
Replace this (2 times):
docmd.set warnings
with this:
DoCmd.SetWarnings

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Kurt6905,
misread the post - follow PHV's tip
regards,
longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top