Question about Form OnLoad and OnCurrent

S

steve

My question is which is better to use if I want to enable/disable controls
on the form based on the value of another control on the form.

I know I should probably know this, but....

TIA for the help

Steve
 
S

SteveM

Use the OnCurrent event.

The OnLoad event only runs once when the form first loads. The OnCurrent
event runs when a new record is viewed.

Unless this is a continuous form?

Steve
 
K

Ken Snell \(MVP\)

SteveM said:
Use the OnCurrent event.
The OnCurrent
event runs when a new record is viewed.

The Current event occurs when the form first loads its data, and whenever
the user moves to a different record (existing or new).

Unless this is a continuous form?

The Current event works the same regardless of whether the form is in
continuous forms view or in single form view.
 
S

SteveM

Apologies for my incorrect phrasing... that is, of course, what I meant/said.
The Current event works the same regardless of whether the form is in
continuous forms view or in single form view.

Didn't mean to suggest otherwise. What I meant was that the OnCurrent event
will probably not do what he is trying to achieve in a continuous form...

Steve
 
K

Ken Snell \(MVP\)

SteveM said:
Apologies for my incorrect phrasing... that is, of course, what I
meant/said.

< s > I actually did think that was what you meant -- I added my post for
lurkers / future "Googlers" who might see this thread and wonder if that was
the meaning.

Didn't mean to suggest otherwise. What I meant was that the OnCurrent
event
will probably not do what he is trying to achieve in a continuous form...

Continuous forms view would result in the control being disabled in all
records, not just the one on which the focus is -- but that is not a problem
for users so long as no one "freaks out" about seeing the control enable or
disable at once on all the records. I use this technique quite often in my
applications.
 
S

SteveM

<g>

It would work but individual records in a continuous form would all have the
controls enabled/disabled on the basis of what is required in the current
record.
Not a problem if users will put up with it (I know my users wouldn't!).

Steve
 
S

steve

So does the OnCurrent code get executed when the form first loads then?

Thanks for the quick replys!
Steve
 
K

Ken Snell \(MVP\)

SteveM said:
<g>

It would work but individual records in a continuous form would all have
the
controls enabled/disabled on the basis of what is required in the current
record.
Not a problem if users will put up with it (I know my users wouldn't!).

Never had a complaint from users of my applications, though I once was asked
what was happening. Users can work on only one record at a time, and if the
user clicks on one of the other records, the textboxes will enable again if
that is appropriate for that record. Just a visual effect < s >.
 
S

SteveM

Yeah, that would work. I don't have a problem with it...
The users on my current contract are unbelieveably fussy about the simplest
detail. I just know that they would complain that only one record displays as
it should, even thoug it would appear as expected when selected.

Fortunately, I have a couple of ways round this, one of which loads special
FormatConditions at runtime so the controls respond to the criteria in each
row.

Steve
 
K

Ken Snell \(MVP\)

Good point -- steve might be able to use ConditionalFormatting to
disable/enable the textbox without having to have all the other records'
textboxes change the same way.
 

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