Okay, I get a Run-time error '2471': The expression you entered as a query parameter produced this error: 'RCDNMART'. The RCDNMART is my network login.
Okay, I get a Run-time error '2471': The expression you entered as a query parameter produced this error: 'RCDNMART'. The RCDNMART is my network login.
You said the network logins were number values.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Okay sorry that was a typo. Network logins are a mix of letters and numbers. So , if someone has the same first initial and last name they put a corresponding number behind it.
Need a field in EMPLOYEE LIST NEW with the network login USERNAME. Can change the existing UserName field to text and input the actual USERNAME values. Then the DLookup should work. So gather up all the usernames and enter into table.
![SCAN OPERATOR] = DLookup("ID", "[EMPLOYEE LIST NEW]", "UserName='" & Environ("USERNAME") & "'")
Or maybe the DLookup should be looking at tblSecurity to get the employee ID?
Why have [EMPLOYEE LIST NEW] and tblSecurity as separate tables?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Okay, when I try to change the UserName field to a text field I get a message saying " operation is not supported for this type of object" Why am I getting this message? I have all the usernames entered but I can't change the field type.
Want to answer questions from my previous post? Maybe don't need to modify EMPLOYEE table. What fields does tblSecurity have?
COULD NOT enter user names into field if it is not already a text type.
I had no problem changing the field type for UserName. Did you remove the Lookup from the field settings first - change to TextBox?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Okay, I got it to work for what I need. Thank you so so much! I have one last question. How do I keep the number from changing when a different user opens the form?
What number?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The ID number that the code gets from the table. Say if the original user works the record and then someone goes behind and opens that form it will put that users ID into that control overwriting the previous ID.
Maybe:
If IsNull(![SCAN OPERATOR]) Then
![SCAN OPERATOR] = DLookup("ID", "[EMPLOYEE LIST NEW]", "UserName='" & Environ("USERNAME") & "'")
End If
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Okay, another problem has come up from the code. The problem is on another form that is query based. When I open the form called "BATCH HEADER SHEET INPUT" in the "scan operator" control it shows the users login and not the "ID". This form needs to show users "ID" not their logins for security reasons. How would I go about doing this?
Options:
1. multi-column combobox
2. include table with user ID in the form RecordSource, bind textbox to the ID field and set properties Locked Yes, TabStop No
3. DLookup() expression
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Okay, so management doesn't want combobox and option 2 doesn't work. The login is being stored on the table and this is where the query is getting it from. So, let's try the DLookup expression. I'm guessing it will be very close to the other expression that you gave me earlier in this thread? So, instead of "user='" & Environ("USERNAME") & "'") because I don't want the user who is running the query to be inputted in the control, what should be put there?
Why doesn't option 2 work? How are tables related?
I downloaded your db from earlier post. What should I look at? It doesn't have the form you referenced. If I remember right, there were some issues with the data in Employee table. The UserName is just a number. UserSecurity and User are empty. Do you want to provide current version?
I am rather confused but maybe like:
=DLookup("ID", "tablename", "userlogin='" & Me.Login & "'")
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Here is the db with the form I mentioned earlier. For the query parameters enter in "test" for my test file. My luck it won't work right for you. Every time I upload my db for someone to look at it never works. Thanks!