<QUOTE>
Thanks, Dirk! I got your correction below. The form's Allow Edits
property is set to "Yes".
How are you distinguishing the read-only users from updating users? I'm
guessing you have code in the form's Open or Load event that is currently
setting the AllowEdits property. You have to change this to take one of
the
approaches I mentioned above.
Users login with either their personal username/password which has
permissions assigned to them or a "generic" read-only username/
password.
This is the current AfterUpdate:
Private Sub cbProfileID_AfterUpdate()
Dim strNewProfile As String
With Me.cbProfileID
' Capture the profile ID the user has selected or entered.
strNewProfile = .Value & vbNullString
If Len(strNewProfile) = 0 Then
' We've no idea what the user has in mind, so
' leave this alone.
Exit Sub
End If
' Is the user's entry an existing profile ID?
If .ListIndex = -1 Then
' This is not an existing profile ID.
' If we aren't on a new record, undo this entry,
' go to a new record, and re-enter it there.
If Not Me.NewRecord Then
.Undo
Me.Undo
RunCommand acCmdRecordsGoToNew
.Value = strNewProfile
' Me.cbProfileID = strNewProfile
End If
Else
' This is an existing profile ID.
' Undo the entry on this record and
' go to the record that was entered.
.Undo
Me.Undo
Me.Recordset.FindFirst "txtProfileID=""" & strNewProfile &
""""
End If
End With
End Sub
I've tried several edits to this but none have permitted navigation to
an existing record when logged in as a read-only user.
</QUOTE>
Ahah! Now I see what's up. I didn't realize that you were using workgroup
security, but it comes down to the same issue as if you'd just set
AllowEdits to No -- except that you can't override the ULS by changing the
AllowEdits property.
The problem is that this not an unbound control. You've overloaded a bound
combo box so that it can be used both for data entry (on a new record) and
for navigation. But on a read-only form, you can't edit any bound controls.
Period. The overloaded control will not work for read-only users.
So what would be a good workaround? You *could* use a separate control for
navigation, and use just a plain text box for actual data entry of this
field. But that does take extra space on the form, and presumably your
users are accustomed to working with a control that behaves the way your
combo box currently does. So <Blackadder> I have a cunning plan
</Blackadder> .
My idea is to detect, when the form is loaded, whether it is read-only or
not. If it's read-only, *unbind* the combo box from its controlsource, and
then in the form's Current event, have code to assign the value from the
controlsource field to the combo box. Am I right in thinking that the
ControlSource for you combo box "cbProfileId" is a field named
"txtProfileID"? If that's so, use code like this:
'----- start of code -----
Private Sub Form_Load()
If Me.Recordset.Updatable = False Then
' Unbind the cbProfileID control so that it can be used
' for navigation.
Me!cbProfileID.ControlSource = ""
End If
End Sub
Private Sub Form_Current()
' If this form is not updatable, manually set
' cbProfileID to the value of the txtProfileID field.
If Me.Recordset.Updatable = False Then
Me!cbProfileID = Me.txtProfileID
End If
End Sub
'----- end of code -----
In addition to that, you'll also need to modify your cbProfileID_AfterUpdate
procedure to allow for the possibility that the user *can't* add another
record, because the form is not updatable.