A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form event not firing on change



 
 
Thread Tools Display Modes
  #1  
Old February 29th, 2008, 08:03 PM posted to microsoft.public.access.forms
John Keith
external usenet poster
 
Posts: 26
Default Form event not firing on change

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John
  #2  
Old February 29th, 2008, 08:11 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Form event not firing on change

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #3  
Old February 29th, 2008, 08:27 PM posted to microsoft.public.access.forms
John Keith
external usenet poster
 
Posts: 26
Default Form event not firing on change

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #4  
Old February 29th, 2008, 08:30 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Form event not firing on change

I don't use the Microsoft Calendar control because it is an Active X control
and I avoid using them; however, if the calendar control has an After Update
or Lost focus event, you could execute the query from there.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #5  
Old February 29th, 2008, 09:11 PM posted to microsoft.public.access.forms
John Keith
external usenet poster
 
Posts: 26
Default Form event not firing on change

Aye, me too MsCal.ocx at first looked like exactly what I needed, and it
worked for about 30 minutes of testing, after which I got a message from
access saying it was corrupt and the dialog box let me "reinstall" the
component. However from that point on, the value of the day clicked on was
not changing the ocxCalendar.value at the top of the code (like it had done
origianlly) After searching the web and this forum I discovered the
hornets-nest that was known as "Microsoft Calendar 11 Active X control" One
of the posts that was telling about the issues mentioned a free calendar
download that was implemented fully as a MSAccess form.

It is this access form popup calendar that I am now using.
Here is a link to the calendar form I am using:
http://www.advancingsoftware.com/FreeDownloads.html

I have made the suggested change to the download modules that allow one
calendar to be called for several date fields. My main form has a global
variable ctlIn that is set when one of the date field's gotFocus or MouseDown
event runs. The Field name is passed through via sControlName.

Set ctlIn = Me.Controls(sControlName)
DoCmd.OpenForm "frmCalendar"

Those statements are in the main form module. I attempted to call the main
forms afterupdate event from the frmCalendar's module but the Me object is
not the correct one at that point.

I also tried setting ctlIn.Dirty = true; thinking that this would make the
event fire after the main form was the current form again, but I was not able
to get the synxax right.

How would I code a reference to the mainform so I could use it's control
values from outside the mainform module? I need to have the groupkey
available to stick in the SQL update's Where clause. I already have the date
value because the frmCalendar's local variable has that for me already. I am
thinking that a new global variable could be set at the same time ctlIn is
being set (or perhaps I just need the correct syntax for refering to
ctlIn.GroupKeyValue. I will also need a correct reference to the sub-form as
a newMe.Control("subform") type that will allow a .requery

--
Regards,
John


"Klatuu" wrote:

I don't use the Microsoft Calendar control because it is an Active X control
and I avoid using them; however, if the calendar control has an After Update
or Lost focus event, you could execute the query from there.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #6  
Old February 29th, 2008, 09:18 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Form event not firing on change

Not a global varialbe. They are not as bad as ActiveX controls, but do come
with a set of problems.

If you need to address your main form from the calendar control's module (I
assume it must be an add in if you weren't able to use Me.) you need to
reference the main form as
Forms!NameOfForm!Name Of Control.

You can't run the main form's After Update event from another module,
because it is public; however, you could create a Public Sub in a standard
module and more your After Update code there. Then in the AfterUpate event
call the public sub. Then you could also call it from the calander's module.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

Aye, me too MsCal.ocx at first looked like exactly what I needed, and it
worked for about 30 minutes of testing, after which I got a message from
access saying it was corrupt and the dialog box let me "reinstall" the
component. However from that point on, the value of the day clicked on was
not changing the ocxCalendar.value at the top of the code (like it had done
origianlly) After searching the web and this forum I discovered the
hornets-nest that was known as "Microsoft Calendar 11 Active X control" One
of the posts that was telling about the issues mentioned a free calendar
download that was implemented fully as a MSAccess form.

It is this access form popup calendar that I am now using.
Here is a link to the calendar form I am using:
http://www.advancingsoftware.com/FreeDownloads.html

I have made the suggested change to the download modules that allow one
calendar to be called for several date fields. My main form has a global
variable ctlIn that is set when one of the date field's gotFocus or MouseDown
event runs. The Field name is passed through via sControlName.

Set ctlIn = Me.Controls(sControlName)
DoCmd.OpenForm "frmCalendar"

Those statements are in the main form module. I attempted to call the main
forms afterupdate event from the frmCalendar's module but the Me object is
not the correct one at that point.

I also tried setting ctlIn.Dirty = true; thinking that this would make the
event fire after the main form was the current form again, but I was not able
to get the synxax right.

How would I code a reference to the mainform so I could use it's control
values from outside the mainform module? I need to have the groupkey
available to stick in the SQL update's Where clause. I already have the date
value because the frmCalendar's local variable has that for me already. I am
thinking that a new global variable could be set at the same time ctlIn is
being set (or perhaps I just need the correct syntax for refering to
ctlIn.GroupKeyValue. I will also need a correct reference to the sub-form as
a newMe.Control("subform") type that will allow a .requery

--
Regards,
John


"Klatuu" wrote:

I don't use the Microsoft Calendar control because it is an Active X control
and I avoid using them; however, if the calendar control has an After Update
or Lost focus event, you could execute the query from there.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #7  
Old February 29th, 2008, 10:13 PM posted to microsoft.public.access.forms
John Keith
external usenet poster
 
Posts: 26
Default Form event not firing on change

I had to modify the syntax slightly:
Forms("formname").Controls("Groupkey") '- to populate the SQL Where clause
Forms("formname").Controls("Datefield") '- to populate the SQL Set clause
Forms("formname").Controls("Subform").Requery '-to make the newly updated
records show in the sub-form

The frmCalendar routine that changed the ctlIn variable then calls a
standard module that references the form in the above syntax does the trick

Thanks for all the help Dave

--
Regards,
John


"Klatuu" wrote:

Not a global varialbe. They are not as bad as ActiveX controls, but do come
with a set of problems.

If you need to address your main form from the calendar control's module (I
assume it must be an add in if you weren't able to use Me.) you need to
reference the main form as
Forms!NameOfForm!Name Of Control.

You can't run the main form's After Update event from another module,
because it is public; however, you could create a Public Sub in a standard
module and more your After Update code there. Then in the AfterUpate event
call the public sub. Then you could also call it from the calander's module.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

Aye, me too MsCal.ocx at first looked like exactly what I needed, and it
worked for about 30 minutes of testing, after which I got a message from
access saying it was corrupt and the dialog box let me "reinstall" the
component. However from that point on, the value of the day clicked on was
not changing the ocxCalendar.value at the top of the code (like it had done
origianlly) After searching the web and this forum I discovered the
hornets-nest that was known as "Microsoft Calendar 11 Active X control" One
of the posts that was telling about the issues mentioned a free calendar
download that was implemented fully as a MSAccess form.

It is this access form popup calendar that I am now using.
Here is a link to the calendar form I am using:
http://www.advancingsoftware.com/FreeDownloads.html

I have made the suggested change to the download modules that allow one
calendar to be called for several date fields. My main form has a global
variable ctlIn that is set when one of the date field's gotFocus or MouseDown
event runs. The Field name is passed through via sControlName.

Set ctlIn = Me.Controls(sControlName)
DoCmd.OpenForm "frmCalendar"

Those statements are in the main form module. I attempted to call the main
forms afterupdate event from the frmCalendar's module but the Me object is
not the correct one at that point.

I also tried setting ctlIn.Dirty = true; thinking that this would make the
event fire after the main form was the current form again, but I was not able
to get the synxax right.

How would I code a reference to the mainform so I could use it's control
values from outside the mainform module? I need to have the groupkey
available to stick in the SQL update's Where clause. I already have the date
value because the frmCalendar's local variable has that for me already. I am
thinking that a new global variable could be set at the same time ctlIn is
being set (or perhaps I just need the correct syntax for refering to
ctlIn.GroupKeyValue. I will also need a correct reference to the sub-form as
a newMe.Control("subform") type that will allow a .requery

--
Regards,
John


"Klatuu" wrote:

I don't use the Microsoft Calendar control because it is an Active X control
and I avoid using them; however, if the calendar control has an After Update
or Lost focus event, you could execute the query from there.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

  #8  
Old February 29th, 2008, 10:16 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Form event not firing on change

Glad you got it working.
You could use:
Forns!FormName!Groupkey, but what you have is fine.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I had to modify the syntax slightly:
Forms("formname").Controls("Groupkey") '- to populate the SQL Where clause
Forms("formname").Controls("Datefield") '- to populate the SQL Set clause
Forms("formname").Controls("Subform").Requery '-to make the newly updated
records show in the sub-form

The frmCalendar routine that changed the ctlIn variable then calls a
standard module that references the form in the above syntax does the trick

Thanks for all the help Dave

--
Regards,
John


"Klatuu" wrote:

Not a global varialbe. They are not as bad as ActiveX controls, but do come
with a set of problems.

If you need to address your main form from the calendar control's module (I
assume it must be an add in if you weren't able to use Me.) you need to
reference the main form as
Forms!NameOfForm!Name Of Control.

You can't run the main form's After Update event from another module,
because it is public; however, you could create a Public Sub in a standard
module and more your After Update code there. Then in the AfterUpate event
call the public sub. Then you could also call it from the calander's module.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

Aye, me too MsCal.ocx at first looked like exactly what I needed, and it
worked for about 30 minutes of testing, after which I got a message from
access saying it was corrupt and the dialog box let me "reinstall" the
component. However from that point on, the value of the day clicked on was
not changing the ocxCalendar.value at the top of the code (like it had done
origianlly) After searching the web and this forum I discovered the
hornets-nest that was known as "Microsoft Calendar 11 Active X control" One
of the posts that was telling about the issues mentioned a free calendar
download that was implemented fully as a MSAccess form.

It is this access form popup calendar that I am now using.
Here is a link to the calendar form I am using:
http://www.advancingsoftware.com/FreeDownloads.html

I have made the suggested change to the download modules that allow one
calendar to be called for several date fields. My main form has a global
variable ctlIn that is set when one of the date field's gotFocus or MouseDown
event runs. The Field name is passed through via sControlName.

Set ctlIn = Me.Controls(sControlName)
DoCmd.OpenForm "frmCalendar"

Those statements are in the main form module. I attempted to call the main
forms afterupdate event from the frmCalendar's module but the Me object is
not the correct one at that point.

I also tried setting ctlIn.Dirty = true; thinking that this would make the
event fire after the main form was the current form again, but I was not able
to get the synxax right.

How would I code a reference to the mainform so I could use it's control
values from outside the mainform module? I need to have the groupkey
available to stick in the SQL update's Where clause. I already have the date
value because the frmCalendar's local variable has that for me already. I am
thinking that a new global variable could be set at the same time ctlIn is
being set (or perhaps I just need the correct syntax for refering to
ctlIn.GroupKeyValue. I will also need a correct reference to the sub-form as
a newMe.Control("subform") type that will allow a .requery

--
Regards,
John


"Klatuu" wrote:

I don't use the Microsoft Calendar control because it is an Active X control
and I avoid using them; however, if the calendar control has an After Update
or Lost focus event, you could execute the query from there.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

The "change" code that needs to run is a SQL update for the table that
updates multiple rows.

My main form handles selecting the group key for the rows. A sub-form shows
the rows that match that group key. The AfterUpdate event handles the
process perfectly, thanks to Albert's quick reply to my "Write Conflict
Issue" recent post. I am now attempting to add the popup calendar form to
pick a valid date and this process launches a new form where the mainform:
datefield control is actually updated. I need to have the Mainform's:
datefield_AfterUpdate event code run when the calendar form's OnClick event
programmatically changes that value.

Hope that makes sense, if not ask again and I will attempt to be more
descriptive.
-
-
Regards,
John


"Klatuu" wrote:

Those events do not fire if data is entered programmatically. The only fire
when a user types data directly into them.

Perhaps if you explain what you are trying to do, we can offer a How To for
you.
--
Dave Hargis, Microsoft Access MVP


"John Keith" wrote:

I am using a pop-up calendar form that is called from my main form.

GotFocus and MouseDown events on the main form are calling the popup
calendar. Once a day has been selected the last thing that happens is the
originating control (the date field on my main form) is being set to the
value of the date selected. This method does not fire the Change,
BeforeUpdate, nor AfterUpdate events.

I have looked at RaiseEvent, but the statement that is setting the value of
the originating control is in calendar form module not the main form module.

I also tried putting the onupdate code in a seperate module that is called
from the calendar form right after the control fields value is set. The Me.
object was not available (perhaps there is a way to assign the current
database to a variable in that module?)

What are the suggested ways to cause the on-change code to execute from a
form class module that is outside the main form?

--
Regards,
John

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:58 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.