Link to home
Start Free TrialLog in
Avatar of urjudo
urjudoFlag for United States of America

asked on

Module in Access

Hi Experts,
I have a question about the module in Access.  Currently I have a module in Access is :

Function GetCaresUser()
Dim CaresUser As String
Dim CaresShortName As String

    CaresUser = Environ("Username")
    CaresShortName = Left(CaresUser, 1) & Mid(CaresUser, (InStr(CaresUser, ".") + 1), 14)
   
    If IsNull(CaresShortName) Then
        GetCaresUser = Null
    Else
        GetCaresUser = CaresShortName
    End If

End Function

John.Smith = jsmith (that's this module does)

This module is when a user login to the network, my access database will check if user's name is there so the user can open the database and what ever the user is doing in the database will be capture their name.  but now I'm having the problem is if the user's name is:
Jane.o'brien = I tried either jo'brien or jobrien or j"obrien
when user login to the network and open the database, it has an error message says "syntax error (missing operator) in query expression 'LoginID = 'jo'brien''.  
what shall I change in the module in order to work for both John Smith and Jane O'Brien

many thanks
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of urjudo

ASKER

Thanks for all help!!!