Hello everyone! In my database i have a field that contains the username of whoever entered the data. It is listed as THISNAME/FirstnameLastname. What could i do to get the query to return only the FirstnameLastname and ignore the THISNAME/ ?
Thanks
Hello everyone! In my database i have a field that contains the username of whoever entered the data. It is listed as THISNAME/FirstnameLastname. What could i do to get the query to return only the FirstnameLastname and ignore the THISNAME/ ?
Thanks
Last edited by brownk; 05-16-2012 at 02:55 PM.
Use string manipulation functions. Will there always be the one slash character?
Mid([fieldname],InStr([fieldname],"/")+1)
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.
Yes, It will always be in that format
Did it work?
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.
No it returns everything
It is returning the full string? Show your attempted query sql statement. Provide sample of actual data.
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.
Mid([firstLast],InStr([firstLast],"/")+1) This is within the criteria field. It returns THISNAME/FirstnameLastname
Last edited by brownk; 05-16-2012 at 02:54 PM.
The expression is intended to be in the Field row to create a field. Then you can apply criteria to that constructed field.
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.
Its now in the field row and still returning the same results.
Show the sql statement for analysis.
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.
Mid([firstLast],InStr([firstLast],"/")+1) AS [First Last]
The query looks fine. Are you saying that the constructed field [Primary Officer] does not show FirstnameLastname part extracted from the original string?
I tested the string manipulation functions on a string with the example structure and it does work.
If you still need help I will have to analyse the project. Follow instructions at bottom of my post.
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.
Yes the full field still shows. It does not extract the FirstnameLastname part.
I have no explanation for why that isn't working. As stated, will have to review project and data directly if you want to provide.
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.
This is just a suggestion as to how I do it. I capture their log in when they add an entry into the database. Sometimes it is good to know who did what.
Add 2 fields to your table
CreatedByUser Text
CreatedDate Date/Time
Copy this in a module
I named mine this
Module name (basMyEmpID ) Module
Option Explicit
Option Compare Database
Public lngMyEmpID As Long
Add the fields anywhere on your form
And put this in the forms Load event
This is just a suggestion as to how I do it. I capture their log in when they add an entry into the database. Sometimes it is good to know who did what.
Add 2 fields to your table
CreatedByUser Text
CreatedDate Date/Time
Copy this in a module
I named mine this
Module name (basMyEmpID ) Module
Option Explicit
Option Compare Database
Public lngMyEmpID As Long
Add the fields anywhere on your form
And put this in the forms Load event
Private Sub Form_Load()
Me!CreatedByUser = Environ("username")
Me!CreatedDate = Now
End Sub
It saves back to the database.
Just a suggestion!!!
Private Sub Form_Load()
Me!CreatedByUser = Environ("username")
Me!CreatedDate = Now
End Sub
It saves back to the database.
Just a suggestion!!!