locked and unlock not doing what I expected

G

Guest

I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for a new
record is 0.

When I go to a new record both are 0 but if I want to put some value in the
truckhours it is LOCKED even though the default grossweight is 0 and it
should be unlocked. I have to input a NEW zero in the gross weight and then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)


Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)

Is there some additional code that I can put somewhere to help so that I
don't have to reput the 0 in manually for the Grossweight so the Truckhours
is unlocked???

thanks,
barb
 
G

Guest

sounds good - not sure of the code to use and where to put it - on what
event???

Thanks,
Barb
wrote:
It sounds like you are saying that when you are working on a new record, you
want the [TruckHours] control unlocked. How 'bout if your code checks the
Me.NewRecord property?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for a new
record is 0.

When I go to a new record both are 0 but if I want to put some value in the
truckhours it is LOCKED even though the default grossweight is 0 and it
should be unlocked. I have to input a NEW zero in the gross weight and then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)


Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)

Is there some additional code that I can put somewhere to help so that I
don't have to reput the 0 in manually for the Grossweight so the Truckhours
is unlocked???

thanks,
barb
 
G

Guest

Any input on what exact code and where to put it. I tried an IIF but am
getting a syntax error-

Thanks for your input,
Barb

Jeff Boyce said:
It sounds like you are saying that when you are working on a new record, you
want the [TruckHours] control unlocked. How 'bout if your code checks the
Me.NewRecord property?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for a new
record is 0.

When I go to a new record both are 0 but if I want to put some value in the
truckhours it is LOCKED even though the default grossweight is 0 and it
should be unlocked. I have to input a NEW zero in the gross weight and then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)


Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)

Is there some additional code that I can put somewhere to help so that I
don't have to reput the 0 in manually for the Grossweight so the Truckhours
is unlocked???

thanks,
barb
 
J

Jeff Boyce

Your original post had an expression to set the locked property. Where were
you using that?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
Any input on what exact code and where to put it. I tried an IIF but am
getting a syntax error-

Thanks for your input,
Barb

Jeff Boyce said:
It sounds like you are saying that when you are working on a new record, you
want the [TruckHours] control unlocked. How 'bout if your code checks the
Me.NewRecord property?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for a new
record is 0.

When I go to a new record both are 0 but if I want to put some value
in
the
truckhours it is LOCKED even though the default grossweight is 0 and it
should be unlocked. I have to input a NEW zero in the gross weight
and
then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)


Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)

Is there some additional code that I can put somewhere to help so that I
don't have to reput the 0 in manually for the Grossweight so the Truckhours
is unlocked???

thanks,
barb
 
G

Guest

The code mentioned in the above and original post is

Attached to the after update event of the grossweight field
Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)

Attached to the afterupdate event of the Truckhours
Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)



When I come in as a NEW record the grossweight default is 0 - so if i keep
the grossweight 0 then they may have a record that is based on HOURLY and NOT
grossweight - for some reason the truck hours is LOCKED and I need to delete
the grossweight 0 and retype the 0 in the gross weight to be able to unlock
the truckhours.


bottonm line if they have a value - other than 0 in the grossweight - they
should not be able to input truck hours and vice versa- not sure how to
resolve this. I am sure and hope it is simple but am just missing it????

thanks,
BArb






Jeff Boyce said:
Your original post had an expression to set the locked property. Where were
you using that?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
Any input on what exact code and where to put it. I tried an IIF but am
getting a syntax error-

Thanks for your input,
Barb

Jeff Boyce said:
It sounds like you are saying that when you are working on a new record, you
want the [TruckHours] control unlocked. How 'bout if your code checks the
Me.NewRecord property?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for a new
record is 0.

When I go to a new record both are 0 but if I want to put some value in
the
truckhours it is LOCKED even though the default grossweight is 0 and it
should be unlocked. I have to input a NEW zero in the gross weight and
then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)


Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)

Is there some additional code that I can put somewhere to help so that I
don't have to reput the 0 in manually for the Grossweight so the
Truckhours
is unlocked???

thanks,
barb
 
J

Jeff Boyce

Ah, now I see. By putting those in the AfterUpdate event, they won't
trigger until the control is updated. Default values don't update.

You could still RUN those events by calling them, when the form loads, or on
the Current event (i.e., a new record), using something like:

Call TruckHours_AfterUpdate()
Call GrossWeight_AfterUpdate()

Good luck!

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
The code mentioned in the above and original post is

Attached to the after update event of the grossweight field
Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or Me.GrossWeight = 0)

Attached to the afterupdate event of the Truckhours
Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or Me.TruckHours = 0)



When I come in as a NEW record the grossweight default is 0 - so if i keep
the grossweight 0 then they may have a record that is based on HOURLY and NOT
grossweight - for some reason the truck hours is LOCKED and I need to delete
the grossweight 0 and retype the 0 in the gross weight to be able to unlock
the truckhours.


bottonm line if they have a value - other than 0 in the grossweight - they
should not be able to input truck hours and vice versa- not sure how to
resolve this. I am sure and hope it is simple but am just missing it????

thanks,
BArb






Jeff Boyce said:
Your original post had an expression to set the locked property. Where were
you using that?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

babs said:
Any input on what exact code and where to put it. I tried an IIF but am
getting a syntax error-

Thanks for your input,
Barb

:

It sounds like you are saying that when you are working on a new
record,
you
want the [TruckHours] control unlocked. How 'bout if your code
checks
the
Me.NewRecord property?

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

I have the below code added to the after update event of the grossweight
field. the default value of both grossweight and truck hours for
a
new
record is 0.

When I go to a new record both are 0 but if I want to put some
value
in
the
truckhours it is LOCKED even though the default grossweight is 0
and
it
should be unlocked. I have to input a NEW zero in the gross
weight
and
then
I can input the truck hours.


Me.TruckHours.Locked = Not (IsNull(Me.GrossWeight) Or
Me.GrossWeight =
0)
Just realizing the below code is attached to the Afterupdate of the
truckhours which is listed AFTER the gross weight


Me.GrossWeight.Locked = Not (IsNull(Me.TruckHours) Or
Me.TruckHours =
0)
Is there some additional code that I can put somewhere to help so
that
I
don't have to reput the 0 in manually for the Grossweight so the
Truckhours
is unlocked???

thanks,
barb
 

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