Calendar control doesn't trigger AfterUpdate event on form

R

ridders

Hi

I am using the AfterUpdate event of a control txtFrom on a form
PSelectReport to filter the dates in a report. This works fine if I just type
in a date in the control.

However I am now using a calendar control to enter a selected date in
txtFrom on using this code; Forms!PSelectReport.txtFrom = Calendar0.Value

Although the date appears correctly in the textbox, it doesn't trigger the
AfterUpdate event for the textbox. The date filter doesn't work on the report

How can I get Access to use the calendar date just as if I had typed in the
date.
 
R

Ron2006

There are only two ways that I can think of right now.

1) duplicate the code that is in the afterupdate event and put in
after "call" for the calendar


OR

2) Execute the afterupdate event in the same place mentioned above. -
Call the afterupdate event just as if it were a function.


Ron
 
W

Wolfgang Kais

Hello "ridders".

ridders said:
I am using the AfterUpdate event of a control txtFrom on a form
PSelectReport to filter the dates in a report. This works fine if
I just type in a date in the control.

However I am now using a calendar control to enter a selected date
in txtFrom on using this code;
Forms!PSelectReport.txtFrom = Calendar0.Value

Although the date appears correctly in the textbox, it doesn't
trigger the AfterUpdate event for the textbox.
The date filter doesn't work on the report.

How can I get Access to use the calendar date just as if I had
typed in the date.

One way could be to write a public sub in the class module of the
form PSelectReport like this:

Public Sub CallAfterUpdate()
Call txtFrom_AfterUpdate
End Sub

Then call this after changing the value of the textbox, like this:

Forms!PSelectReport.CallAfterUpdate

An other way could be to set the focus on the textbox before changing
it's value an the not change it's Value but it's Text property.
 
R

ridders

Hi Wolfgang

I had already tried SetFocus but it didn't work.
However the Call routine worked perfectly

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top