Organizational Research By

Surprising Reserch Topic

locking combo box on access 2003 using -'combobox'


locking combo box on access 2003  using -'combobox'

i want to allow only the administrators to change/update a combobox with the following code, but it returns an error that the Recordset is empty

Private Sub cboFeeCat_BeforeUpdate(Cancel As Integer)

Dim rsUserName As Recordset
Dim varsql As String
Dim strUser As String
Dim crtUser As String

crtUser = Forms!xaV!txtUser

varsql = "Select * from xaUser Where UserInit = '" & crtUser & "';"
Debug.Print varsql

Set rsUserName = gcdb.OpenRecordset(varsql)
While Not rsUserName.EOF
strUser = CStr(Trim(rsUserName("UserInit")))


If strUser = "Admin" Then
cboFeeCat.Locked = False
Else
cboFeeCat.Locked = True
End If
Wend

End Sub

    
asked Sep 7, 2015 by rajesh
0 votes
4 views



Related Hot Questions



Government Jobs Opening


...