Change currentuser

Jaye7

Registered User.
Local time
Tomorrow, 03:30
Joined
Aug 19, 2014
Messages
205
I know that people are going to want to attack me for this question, if that is you, then please just move on.

I want to know if it's possible to change the currentuser temporarily using code.

Why?

Because I am moving away from the security and just having a logon database which copies a database and gives each user their own database and I will then store their user name in a table in their database.

The reason why I want to change the currentuser is because I have loads of queries that write the currentuser into various tables and I don't want to have to go and change them all and add textboxes to forms etc... and then have to write code to then get the username etc... if there is some easy code available like set currentuser = "Jim".

I would rather be lazy (negative) or work smarter (positive)
 
I don't understand your setup but maybe this will help.
PHP:
Dim LUser As String

LUser = CurrentUser()

Better yet, if I understand, just hard code the user to whatever in your table.
 
Last edited:
what you need is a proper login system.

get the user to login, and check the user name against a table.

so then your you can have your own "currentuser" which determines who is logged in, and your forms can do what they need based on that.
 
Thanks for responding but I don't think that you read this section properly.

The reason why I want to change the currentuser is because I have loads of queries that write the currentuser into various tables and I don't want to have to go and change them all and add textboxes to forms etc... and then have to write code to then get the username etc... if there is some easy code available like set currentuser = "Jim".
I have a load of queries that have currentuser in them (in various fields) and I don't want to have to go into every query and change the fields to reflect textboxes or dim statement's, I want to change the currentuser based on the user in my table ONCE upon opening, so if I could change it by something like set currentuser = "Jim" (based on the table value) etc... it would save hours/days of my time.

Maybe an API call etc... to change currentuser.
 
replace currentuser with your own function

public gblusername as string

function currentuser as string
currentuser = gblusername
end function

then simply
gblusername = "Jim" will give you what you want
 
Thanks Dave, sorry for calling you Gemma, I didn't read your signature until now, Usually I reply to people using their user name as that's the only name provided.
 

Users who are viewing this thread

Back
Top Bottom