Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 March 21st, 2007, 10:20 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Automating Data Entry - subform

I'm trying to save one of my users some time by scripting a repetitive task. I was able to accomplish (I thought) this task using simple SQL Update statements but then realized there was a lot of code in the background that was not running.

What I'm trying to do is a "ship complete" function that will populate the "ship_qty" field with whatever is in the "qty" field and also populate the "ship_date" field with the date listed in the parent form BUT it also needs to run all of the event based code behind the fields and subform.

Obviously the SQL update queries bypassed all of the code so the backend stuff didn't happen. (inventory updates, etc)

Does this make any sense? Is there an easy way to accomplish my goal?
 
Old March 21st, 2007, 01:45 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not sure I follow you completely, but you can run the query from inside your code. Just put:
DoCmd.OpenQuery "querynamehere"

HTH,

Dave

 
Old March 21st, 2007, 02:11 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That's what I'm doing that's not working.

What I need to do is simulate user entry so that the "After Update" event fires for each field that's updated.
 
Old March 21st, 2007, 04:09 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts
Default

use a call statement to call the routines that don't fire. For instance:
--------------------------------------------------------
My_Combo.value = "New Value"
Call My_Combo_AfterUpdate 'Runs AfterUpdate routine of combo box when value changes in way that doesn't cause it to fire
--------------------------------------------------------
Just be careful of looping. Don't call the afterupdate from a function that gets called with the afterupdate routine.

 
Old March 22nd, 2007, 06:22 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

What is the code in the After Update event of the main form? What is the event that you added to do your SQL update? I think you need to take the After Update event code and put it in line with the code you added on the event you added. Does that make sense?

If I had code that was going to repeat like this, I would normally put it in a module and then call it from all the events that I wanted to run the function on.

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Help required for data entry format Creatoronline SQL Server 2000 1 May 27th, 2008 01:58 PM
Data Entry from Repeater m_t_clayton ASP.NET 2.0 Professional 0 March 20th, 2006 06:13 PM
New Record Data entry one form lgpatterson Classic ASP Basics 1 February 8th, 2005 12:58 AM
Data entry from email SiliconFuRy PHP Databases 4 December 17th, 2004 09:40 AM
error in data entry vickyj SQL Server 2000 6 September 13th, 2004 10:02 AM





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