Db-why-not
Registered User.
- Local time
- Yesterday, 22:00
- Joined
- Sep 17, 2019
- Messages
- 159
I have query that uses a function and a dropdown box, cboTechnician to get different criteria. When "All Technicians" is selected from my dropdown box I want the criteria/function to show all values for a field except the value in my login textbox, cboUser that is open. I had previously set it up to actually show all records, but I need to it to show all records except the value in my login textbox. IT works to show all records, but it doesn't work when I show only records not = cbouser (it doesn't show anything when "all Data Tecnicians" is selected.
This value is in my criteria field: Like fCboSearch([Forms]![Welcome_Menu]![cboTechnician])
This value is in my criteria field: Like fCboSearch([Forms]![Welcome_Menu]![cboTechnician])
Code:
'This function not working properly, shows nothing when "all data technicians", shows correctly when anything else is selected
Public Function fCboSearch(vCboSearch As Variant)
If vCboSearch = "All Data Technicians" Then
'Prevents data techs from seeing records they worked on
fCboSearch = "Not [Forms]![Login_frm]![cboUser]"
Else
fCboSearch = vCboSearch
End If
End Function
'This function works it shows all records, but I needed to modify it to show only values not = to my cboUSer textbox
Public Function fCboSearch(vCboSearch As Variant)
If vCboSearch = "All Data Technicians" Then
fCboSearch = "*"
Else
fCboSearch = vCboSearch
End If
End Function