Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-04-2019, 12:06 AM   #1
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Which Event?

Hi all,
I have a combo in a form, where I enter values either by picking one from the list or writing a new one (on NotInList). Saved values may also change in the future.
I want to trigger a procedure (besides saving the record) after saving a new value, or changing an existing one, without adding a new button (if possible). I wonder under which event of this combo I should put the code. (I know AfterUpdate or OnDirty won't always do the job).


Thank you all

AlexN is offline   Reply With Quote
Old 12-04-2019, 12:57 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,376
Thanks: 0
Thanked 746 Times in 731 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Which Event?

I don't follow,
you want to pick a value in a combo, then use the event to add more values to the combo?
or
add new values to a different table? (combo has only 1 value)
Ranman256 is offline   Reply With Quote
The Following User Says Thank You to Ranman256 For This Useful Post:
AlexN (12-04-2019)
Old 12-04-2019, 01:22 AM   #3
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Re: Which Event?

I want to add a value to another table. This value won't be the same with the one picked by the combo but depending on it.
But...
It doesn't really matter what I want to do. It's when and how I can trigger the code to do it that matters.
Let's say the combo picks full names from a client list (or adds new ones through the code behind its NotinList event, and besides saving this record to the underlying table, I want to add clients first name to another table (this is an example).
I want to know under which event I should put the code, since AfterUpdate or OnDirty won't trigger always, and OnChange will trigger multiple times if I enter a non existing value in the combo.

AlexN is offline   Reply With Quote
Old 12-04-2019, 01:38 AM   #4
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,888
Thanks: 38
Thanked 571 Times in 538 Posts
MajP has a spectacular aura about MajP has a spectacular aura about
Re: Which Event?

Why would after update be I insufficient?
MajP is offline   Reply With Quote
The Following User Says Thank You to MajP For This Useful Post:
AlexN (12-04-2019)
Old 12-04-2019, 01:45 AM   #5
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Re: Which Event?

Because AfterUpdate only triggers if you enter a value by typing in and not if you choose it from a list. Same thing happens with OnDirty also (well almost).

Last edited by AlexN; 12-04-2019 at 01:53 AM.
AlexN is offline   Reply With Quote
Old 12-04-2019, 01:52 AM   #6
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,252
Thanks: 115
Thanked 3,075 Times in 2,793 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Which Event?

Add another _Click event as follows

Code:
Private Sub ControlName_Click()
   ControlName_AfterUpdate
End Sub
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
AlexN (12-04-2019)
Old 12-04-2019, 01:58 AM   #7
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Re: Which Event?

Quote:
Originally Posted by isladogs View Post
Add another _Click event as follows

Code:
Private Sub ControlName_Click()
   ControlName_AfterUpdate
End Sub


You mean I should put the code under the AfterUpdate event and then put your suggestion under the OnClick to force AfterUpdate triggering? Am I close?

AlexN is offline   Reply With Quote
Old 12-04-2019, 02:00 AM   #8
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,252
Thanks: 115
Thanked 3,075 Times in 2,793 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Which Event?

That's exactly what I meant though in fact this may work better

Code:
Private Sub ControlName_Change()
   ControlName_AfterUpdate
End Sub
I've used this myself in a few places & it did the job!
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
AlexN (12-04-2019)
Old 12-04-2019, 02:05 AM   #9
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Re: Which Event?

Quote:
Originally Posted by isladogs View Post
That's exactly what I meant though in fact this may work better

Code:
Private Sub ControlName_Change()
   ControlName_AfterUpdate
End Sub
I've used this myself in a few places & it did the job!


That's brilliant isladogs!!!
It would have never cross my mind. Thank you so much!!!
AlexN is offline   Reply With Quote
Old 12-04-2019, 05:07 AM   #10
AlexN
Newly Registered User
 
AlexN's Avatar
 
Join Date: Nov 2014
Location: Athens, Greece
Posts: 223
Thanks: 121
Thanked 14 Times in 14 Posts
AlexN is on a distinguished road
Re: Which Event?

isladogs your idea was perfect! I didn't use the OnChange event though, because there's also a NotInList event firing some code. I rather used the DoubleClick event just to prevent code from firing on an accidental click.


Thank you all for your contribution!
AlexN is offline   Reply With Quote
Old 12-04-2019, 07:38 AM   #11
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,252
Thanks: 115
Thanked 3,075 Times in 2,793 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Which Event?

Glad I could help

__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Common sense and a sense of humour are the same thing, moving at different speeds. (Clive James - RIP)
isladogs is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Double Click event not triggering After Update event George-Bowyer Modules & VBA 7 03-14-2019 11:50 PM
VbYes/No event in Button Click event mba_110 Forms 0 03-12-2017 05:16 AM
Form's Error Event takes precedence before Click event for Undo button Banana Forms 7 09-04-2008 04:15 PM
Event for reports similar to the forms Current event KeithG Reports 1 03-20-2008 11:11 AM
Click event has priority over exit event pbuethe Modules & VBA 5 06-22-2004 04:52 AM




All times are GMT -8. The time now is 05:31 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World