Hi, all--
I am wanting to have the RowSource property of a subform control change based on the currentuser so that the use can only select one item in a control box.
I thought I could use the following code:
If Application.CurrentUser = "JSmith" Then
Me.frmIndContactNotesub.Form.Clinician.RowSource =
"SELECT tblEmployeeList.EmployeeName," & _
"tblEmployeeList.StaffID" & _
"FROM tblEmployeeList WHERE tblEmployeeList.StaffName = 'Smith, John';"
End If
I also tried:
If Application.CurrentUser = "JSmith" Then
Me.frmIndContactNotesub.Form.Clinician.RowSource =
"SELECT tblEmployeeList.EmployeeName," & _
"tblEmployeeList.StaffID" & _
"FROM tblEmployeeList WHERE tblEmployeeList.StaffID = 3;"
End If
While I am not getting an error in either, it's also not doing what I want: to have one item available in the control box. The control box has no items at all--it is blank.
I currently have no value in the RowSource property for the control, which is bound on column 2 which is a numerical ID, the first column being the actual name (text).
Any help will be appreciated.
Thanks.
I am wanting to have the RowSource property of a subform control change based on the currentuser so that the use can only select one item in a control box.
I thought I could use the following code:
If Application.CurrentUser = "JSmith" Then
Me.frmIndContactNotesub.Form.Clinician.RowSource =
"SELECT tblEmployeeList.EmployeeName," & _
"tblEmployeeList.StaffID" & _
"FROM tblEmployeeList WHERE tblEmployeeList.StaffName = 'Smith, John';"
End If
I also tried:
If Application.CurrentUser = "JSmith" Then
Me.frmIndContactNotesub.Form.Clinician.RowSource =
"SELECT tblEmployeeList.EmployeeName," & _
"tblEmployeeList.StaffID" & _
"FROM tblEmployeeList WHERE tblEmployeeList.StaffID = 3;"
End If
While I am not getting an error in either, it's also not doing what I want: to have one item available in the control box. The control box has no items at all--it is blank.
I currently have no value in the RowSource property for the control, which is bound on column 2 which is a numerical ID, the first column being the actual name (text).
Any help will be appreciated.
Thanks.