Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

To Lock or not to Lock

Status
Not open for further replies.

AmigoMobility

Technical User
May 8, 2005
57
US
I'm going live with my DB tomorrow morning. I wanted to to Edited Records for my lock type but ran into a problem, this weekend when I took it to our office and had it on multiple computers for the first time. (I've been designing at my house, in my spare time (right), so I couldn't test for the problem I have now.) When a user is on a record and I open the same record up on another computer it locks ok and shows in the Record Selector that it's locked but if I begin to tab through the form I have at least one code that pukes. In my LastName field, in the On Exit event, I have the following code:
If Not (IsNull(Me.LastName)) Then
Me.LastName = StrConv(Me.LastName, vbProperCase)
End If
As I try to Exit this field, only when the record is locked, the code pukes. Can some one lend a hand and give some advise on how to prevent this?

Thanks ahead of time,
Shane


 
the code pukes
Any chance you could post the error message ?
Why not write an Error handler routine in your event procedure ?


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PH. I'm not at the office now but if I remember right to error says something about the object. Either that is doesn't support the method or the value can not be assigned to the object. Something along those lines. Sorry I can do better than that. It's weird that the same code works if the record is not locked. Only if it's locked.

As far as writing an Error handler routine. I would love to if I knew what to trap for but I'm confused as to why it's doing it.

I'm in medical sales and doing this for our small family owned business so I don't do this for a living and some of this stuff can get pretty confusing to me.

Shane
 
Another way is to put your code in the BeforeUpdate event procedure of the LastName textbox instead of the Exit one.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Shane -
It's popping an error because your code is trying to write to a locked record. It's testing for data in the field, finding data, then trying to execute the StrConv function on it. If the record is not locked, no problem. If it's locked - well, you know the result. PHV is right, use the BeforeUpdate event instead of the OnExit event.

Ken S.
 
Thanks, Ken & PHV. I'll give it a try in the morning.

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top