Jumat, 06 November 2015

[MS_AccessPros] Re: How to track users in a split database?

 

Bill,


In theory I trap them all, but I rem out the On Error line when I'm having issues with something, and don't always remember to undo that.


What's an ACCDE and how do I do that?

Adam

---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Adam

A global variable (also called a Public variable) is declared in the declaration area of any standard module. It would look like this:

Option Compare Database
Option Explicit
Public PstrUserName As String

That makes it assignable and readable from anywhere in your code and it stays in scope until you close the database. But like I said, you can only count on it if you trap all errors in MDBs and ACCDBs or give your users MDEs or ACCDEs (which I always do). Otherwise, an error might cause the variable to lose its value. Of course, you can always check the value and if it is "" just use your code to assign it again.

-Bill

---In MS_Access_Professionals@yahoogroups.com, <runuphillracing@...> wrote :

Bill,


I've never used a global variable. How does that work? Is that better than tblUser?


Adam



---In MS_Access_Professionals@yahoogroups.com, <wrmosca@...> wrote :

Adam

 

I'd use a table for this. Make it a local table and run a "DELETE* FROM myTable" query when the database opens. Then insert the user name into the table so there is only the one record.

 

By the way, if you give the user a compiled ACCDE or MDE file you can just assign the user name to a global variable. Those two versions of the database will retain the variable's value even if there is an unhandled error during processing.

 

Regards,
Bill Mosca,
Founder, MS_Access_Professionals
That'll do IT http://thatlldoit.com
MS Access MVP
http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852

My Nothing-to-do-with Access blog

http://wrmosca.wordpress.com

 

From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, November 05, 2015 10:28 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] How to track users in a split database?

 

 

I'm getting the user via the GetUserName function. I keep track of the user throughout their session to manage permissions and hidden fields on different forms. In the past, I've put the name into a hidden, unbound form, frmUser, with a field UserName, that I refer to in Form_Current events. Is there a "better" way of doing this?

 

Adam

Denver, CO

__._,_.___

Posted by: runuphillracing@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (5)

.

__,_._,___

Tidak ada komentar:

Posting Komentar