Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 23rd, 2003, 10:46 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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 Procedure Calling Syntax Needed

What is the syntax or method needed to trigger an AfterUpdate event or an OnClick event of a control that is located in a second open form that is hidden behind the active form? That is, FormB is open and on top (is active, has the focus), but I want to trigger an AfterUpdate event in FormA (hidden behind FormB, doesn't have the focus, not the active form).
  • FormB is open. Click a button on FormB.
  • FormA gets the focus.
  • A combobox is filled in FormA with data from FormB.
  • The combobox's AfterUpdate event triggers.
  • FormB closes.
I'm getting a "Procedure not Found" error even if I give FormA the focus first before closing FormB.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
Reply With Quote
  #2 (permalink)  
Old October 23rd, 2003, 10:54 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forms![FormA].SetFocus

Sal
Reply With Quote
  #3 (permalink)  
Old October 23rd, 2003, 11:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Oxford, , United Kingdom.
Posts: 120
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Greg

Can't you extract the relevant code from the AfterUpdate event and place it in it's own public Sub/Function?

The you'd just need to place
Code:
Forms![FormA].PublicFunctionName
where ever it's needed


Brian Skelton
Braxis Computer Services Ltd.
Reply With Quote
  #4 (permalink)  
Old October 23rd, 2003, 11:19 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was finger happy earlier,

Try this on the after update of the combo box in FormA

DoCmd.Close acForm, "FormB", acSaveNo

Sal
Reply With Quote
  #5 (permalink)  
Old October 24th, 2003, 07:03 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
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

Thanks it works now. Seems that although I had everything in the correct order, including the .SetFocus, the reason Form A's event didn't want to fire off was I didn't express the event as a property. Namely:

Code:
'Old Way, Starting at Form B

   Forms.frmFormA.SetFocus
   Me.cboMyCombobox = Forms.frmFormB.Form.txtMyTextBox
   cboMyCombobox_AfterUpdate
   DoCmd.Close acForm, frmFormB


'New Way, Starting at Form B

   Forms.frmFormA.SetFocus
   Forms.frmFormA.cboMyCombobox = Forms.frmFormB.Form.txtMyTextBox
   Forms.frmFormA.cboMyCombobox_AfterUpdate
   DoCmd.Close acForm, frmFormB


Although the "old" way normally works just fine when I'm starting and ending in the same form, the mere fact that I was starting in another form caused Access to require me to be explicit. I had to express the event as a property and it was confused by the "Me." even though I switched forms, so I had to use the "Forms.frmFormA.".

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
calling stored procedure jomet JSP Basics 0 November 23rd, 2007 08:06 AM
Stored Procedure Syntax Problem MaxGay SQL Server 2000 1 November 4th, 2004 05:16 PM
Syntax Needed SerranoG Access VBA 4 February 6th, 2004 06:41 PM
Word VBA Syntax Needed SerranoG VB How-To 4 October 28th, 2003 02:16 PM
SQL syntax for my query - guru needed badgolfer Access 2 September 20th, 2003 01:52 PM



All times are GMT -4. The time now is 12:06 PM.


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