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 / Forms / October 2007

Tip: Looking for answers? Try searching our database.

locked and unlock not doing what I expected

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
babs - 23 Oct 2007 03:09 GMT
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
Jeff Boyce - 23 Oct 2007 11:44 GMT
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?

Signature

Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

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
[quoted text clipped - 18 lines]
> thanks,
> barb
babs - 23 Oct 2007 12:51 GMT
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
[quoted text clipped - 25 lines]
> > thanks,
> > barb
babs - 24 Oct 2007 01:49 GMT
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
[quoted text clipped - 25 lines]
> > thanks,
> > barb
Jeff Boyce - 24 Oct 2007 13:23 GMT
Your original post had an expression to set the locked property.  Where were
you using that?

Signature

Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

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

> Any input on what exact code and where to put it.  I tried an IIF but am
> getting a syntax error-
[quoted text clipped - 31 lines]
> > > thanks,
> > > barb
babs - 29 Oct 2007 22:55 GMT
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

> Your original post had an expression to set the locked property.  Where were
> you using that?
[quoted text clipped - 44 lines]
> > > > thanks,
> > > > barb
Jeff Boyce - 31 Oct 2007 12:05 GMT
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!

Signature

Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

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

> The code mentioned in the above and original post is
>
[quoted text clipped - 65 lines]
> > > > > thanks,
> > > > > barb
 
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.