Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / April 2005

Tip: Looking for answers? Try searching our database.

Run Function on any data change in a Form?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HumanJHawkins - 04 Apr 2005 23:13 GMT
I have a .adp connected to SQL. The visibility of some of the fields should
be dependant on the data from other fields.

So, I want to run a function like the following every time the user changes
anything:
 Function UpdateDisplay()
     If vchFactType = "multiple" Then
         iMultipleLimit.Visible = True
     Else
         iMultipleLimit.Visible = False
     End If
 End Function

I have tried the "Private Sub Form_SelectionChange()" function, but it
doesn't seem to trigger the function when my selection on the form actually
changes.

What is the standard way of doing this?

I also want to run the same function when the user goes from one record to
the next... I can't seem to find how to do this either.

Thanks in advance for any help.
Arvin Meyer - 05 Apr 2005 01:29 GMT
Controls on bound forms have a Dirty event that fires the first time the
control is changed per record and a Change event that fires with each change
of the control. There are also KeyPress, KeyUp, and KeyDown events. Similar
events occur on the form with the addition of the Current event that fires
upon reaching a new record. There are also Before and After Update events
for both controls and forms. In fact, Access has more data connected events
than any other DBMS including all other languages.

Open the property sheet, and click on the Event tab, then click in each of
the events and press F1. The help files will tell you what most of them do.
Signature

Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

> I have a .adp connected to SQL. The visibility of some of the fields should
> be dependant on the data from other fields.
[quoted text clipped - 19 lines]
>
> Thanks in advance for any help.
HumanJHawkins - 05 Apr 2005 04:52 GMT
I think your tips about "the Current event" and the before and after update
events are on the right track. These at least will help. But I am really
looking for  a way to handle this at the form level as the user changes
things. I.e. To make it update in real time without adding an "On Change"
type handler for every control on the page.

The goal is not just laziness... I think it would be a lot cleaner and have
less maintenance and debugging as the thing is developed. Is there no event
that fires when any control on a form has been changed?

Thanks!

> Controls on bound forms have a Dirty event that fires the first time the
> control is changed per record and a Change event that fires with each
[quoted text clipped - 37 lines]
>>
>> Thanks in advance for any help.
Sylvain Lafontaine - 05 Apr 2005 06:34 GMT
Create a function and use the following syntaxe for the relevant control
event property:

   =MyFunction()

This will be easy to duplicate for each necessary events by using Ctrl-C or
by using a small piece of code that will modify automatically all the
controls on the form.

You can also setup a macro that will call your function and use it instead.

S. L.

>I think your tips about "the Current event" and the before and after update
>events are on the right track. These at least will help. But I am really
[quoted text clipped - 51 lines]
>>>
>>> Thanks in advance for any help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.