Hi,
I'm wondering how to limit combobox values, that can be chosen by database user, to one option - "username"
So basicly, it should changes depending on who (which user) is working with my DB. I use standard login form, please check "Login" buton code I'm including below. The best way would be to remember username in some kind of a temp value and then pass it to combobox, am I correct?. Unfortunetly I'm not sure how to do it correctly, maybe you can help? Thanks in advance!
Private Sub btnLogin_Click()
Dim rs As Recordset
Dim TempUserName As TempVars
Set rs = CurrentDb.OpenRecordset("tbl1Employees", dbOpenSnapshot, dbReadOnly)
rs.FindFirst "UserName='" & Me.txtUserName & "'"
If rs.NoMatch = True Then
Me.lblWrongUser.Visible = True
Me.txtUserName.SetFocus
Exit Sub
End If
Me.lblWrongUser.Visible = False
If rs!Password <> Me.txtPassword Then
Me.lblWrongPass.Visible = True
Me.txtPassword.SetFocus
Exit Sub
End If
Me.lblWrongPass.Visible = False
If rs!EmployeeType_ID = 3 Then
Dim prop As Property
On Error GoTo SetProperty
Set prop = CurrentDb.CreateProperty("AllowBypassKey", dbBoolean, False)
CurrentDb.Properties.Append prop
SetProperty:
If MsgBox("Czy chcesz przywrócić funkcjonalność bypass key?", vbYesNo, "Allow Bypass") = vbYes Then
CurrentDb.Properties("AllowBypassKey") = True
Else
CurrentDb.Properties("AllowBypassKey") = False
End If
End If
DoCmd.OpenForm "FormularzNawigacji"
DoCmd.Close acForm, Me.Name
End Sub