Locked field

M

madisonlynn

I have a locked field that captures the user name automatically. Now User
name is a field among other fields in a record. When I use my form to
find a record it populates the data into the fields. What i'm trying to
do is capture the User name that just populated into the locked field and
use it in code for my sub routines. One problem though, when I type in
Me.UserID I get null, but its not null. Below is my code. Can someone
tell me where I went wrong?

Cancel = True
MsgBox "Required field." & vbCrLf & "Scan barcode!",
vbExclamation
Me.txtDocID.SetFocus
Exit Sub
Else
If Len(Me.[DocID].Value) <> 8 Then
MsgBox "The Document ID should consists of 8 characters and
numbers."
'Cancel = True
'Me.Undo
'GoTo Exit_Here
End If
If blnAdd Then
With Me.RecordsetClone
.FindFirst "DocID = """ & Me.[DocID] & """"

If Not .NoMatch Then
Dim Msg As String
Beep
Msg = ""
Msg = Msg & "This Record already exists! Let me find
it for you."
MsgBox (Msg)

Me.Undo
blnAdd = False
Me.txtDocID.Locked = True
Me.Bookmark = .Bookmark
'Me.cmdAdd.SetFocus
If Not IsNull(txtFileNetDocID) Then
Me.cmdDelete.Enabled = False
Me.cmdSave.Enabled = False
Me.AllowDeletions = False
Me.AllowEdits = False
MsgBox "This Record is already in FileNet!
Changes to any record will need to be made in FileNet."
GoTo Exit_Here
Else
'If IsNull(txtFileNetDocID) Then
If Me.UserID = GetCurrentUserName() Then
Me.AllowDeletions = True
Me.AllowEdits = True
Me.cmdDelete.Enabled = True
Me.cmdSave.Enabled = True
End If
'End If
GoTo Exit_Here
End If
GoTo Exit_Here
End If
End With
End If
GoTo Exit_Here
 
G

GVaught

I think when a field is locked it is not readable as well as writeable. You
may have to set the lock to No and set Enabled to No.
 
G

GVaught

change of thought

Here is what help says:

Enabled Locked Effect
Yes Yes The control can have the focus. Data is displayed normally and
can be copied but not edited.
Yes No The control can have the focus. Data is displayed normally and
can be copied and edited.
No Yes The control can't have the focus. Data is displayed normally
but can't be copied or edited.
No No The control can't have the focus. Control and data are disabled
(dimmed).


Is it possible to keep the username field enabled and not locked and just
set the visibility to false. Me.Username.visible = False.
 
M

madisonlynn

I've set the two fields UserID and FileNetDocID to Yes Enabled and No
Locked, but it still doesn't capture the filtered data. However, I do
notice that if you enter data yourself than the field is not null. It has
something to do with the keyboard I believe. I've also tried to set
Visible to False and its not a good idea. I need to show the id to the
user. Any other input?

Thanks in advance for your help.
 
M

madisonlynn

Thanks for your help. It was more complicated than that, but its all fixed
now.
 

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