Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2008, 04:03 PM
Registered User
 
Join Date: May 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Form Code with VBA

Hi everyone,

I am building a database that collects data from the user and builds a table to collect date and a Form to input that data.

I have managed to build the tables with createtabledef method and build the form and create the controls with the createcontrol method.

I now need to set the afterupdate event to run a specific function and compute a value from two or more fields on the form, known only after collecting the data from the user: for example set the afterupdate event of field 1 and field 2 to sum field 1, field 2 and set field 3 to equal the result.

I tried building a public function in the module that creates the forms and tables however access only let me call "[event procedure]" or a macro from the event property.

Any help would be appreciated.
 
Old October 17th, 2008, 07:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Automating an event procedure for a control on a form that is not created and named yet that is bound to a record source not yet created and named, etc., is probably doable but very tricky. I wish I could help, but I cannot without taking more time than I have to offer.

I've always been fascinated by posts where people describe what you did, i.e. buidling forms and tables from scratch at run-time. Wouldn't it be easier, knowing what the data is for and the business practice, to build the forms and tables ahead of time and have them ready BEFORE data is entered? It would make what you need MUCH easier.

Could you educate me on the advantages of the "on the fly" approach to table and form building?

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old October 17th, 2008, 11:45 AM
Registered User
 
Join Date: May 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I generally agree with you.

However, this specific database is intended to standardize treatment checklists of wounded patients in a multiple casualty and variable environment for EMT instruction. Oh and i forgot to mention multiple instructors as well.

The only constant being the treatment algorithm. The database application "needs" to get input from the instructor about the drill setting, and patient injuries and condition, and manufacture a table for the data and a form to assess EMT performance on scene.

After several EMTs have undergone the drill under the supervision of several different instructors, The database will then "fold" these tables and form and leave only the assessment of performance in a permanent table.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill datasheet/Continuous form with vba code only Galateo Access VBA 0 May 9th, 2008 09:39 AM
Change tbl permissions using VBA feets Access VBA 1 October 12th, 2007 01:19 AM
VBA code to Search All Text Fields on a form dezmond2 BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 1 July 7th, 2007 11:58 AM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
change paper's format with VBA exarkuun Excel VBA 1 December 9th, 2003 11:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.