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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AllowEdits set to False works till use GotFocus()?

Status
Not open for further replies.

kayek

Programmer
Jun 19, 2003
95
0
0
US
When my form opens I have code that will lock certain users from making edits, additions and deletions to the data on the form.

If get_windows_username() = "KTKISLI" Then
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
Me.Form.DataEntry = False
Else
Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Me.Form.DataEntry = True
End If

This works fine untill I have a text box with a gotfocus function. If the user is KTKISI and she goes to text box with the GotFocus() function behind it, she is not able to make an updates to that text box but when she tabs to the next text textbox she is able to make updates. Any texts boxes she goes to after the textbox with the GotFocus() function she can update. Why is the GotFucus() function turning the allowedits back to true?

Private Sub DateFileReturned_GotFocus()
Me.CurrentDateFileReturned = Me.DateFileReturned
Me.TrackChanges = Me.DateFileReturned
End Sub
 
How are ya kayek . . .

Transfer your code to the [blue]OnOpen[/blue] event and be sure to remove the two lines with [blue]DataEntry[/blue] . . .

Calvin.gif
See Ya! . . . . . .
 
I do have the allowedits code in the Form OnOpen event.

I have tried it with and without DataEntry = False

In the GotFocus() sub program, if I take out the below line all works the way it is suppose to. I don't know why this line of code is turning allowedits to true?

Me.CurrentDateFileReturned = Me.DateFileReturned
 
I think I got it fixed. I totally deleted that text box and recreated it and now it seems to lock as it should. Thanks for your time on trying to help me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top