Selasa, 27 November 2012

Re: [MS_AccessPros] Tracking user profile

 

Adam-

I prefer to use a table in combination with Public variables to do this.
It's a known fact that stuff stored in memory can "disappear" of there's
an error. And a "hidden" form may not always be hidden and is slower to
reference.

Here's what I do in a Standard module:

Option Compare Database
Option Explicit

Dim pstrLoginName As String

Public Function GetUser() As String

If Len(pstrLoginName) = 0 Then
pstrLoginName = DLookup("UserName", "ztblUserData")
End If

GetUser = pstrLoginName

End Function

Of course, this assume you stored the user name at login in ztblUserData.

You can write as many "wrapper" functions as you like to grab / populate
the module variables.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: AdamF <runuphillracing@yahoo.com>
Reply-To: <MS_Access_Professionals@yahoogroups.com>
Date: Tuesday, November 27, 2012 9:56 PM
To: <MS_Access_Professionals@yahoogroups.com>
Subject: [MS_AccessPros] Tracking user profile

Currently, when a user logs in, I open an unbound, hidden form, and write
their profile info (from a table using their login name) to that form
(frmUser). I then refer to that form on numerous pages to customize the
view and edit/delete/add authorities. I did this because it seems a lot
quicker to look up in a form than using dlookup to tblUserProfile.

Is there a better way?

I've thought about creating a set of two local (front end) tables with
this info, in lieu of an unbound form.

I think I recall somewhere about tracking properties in VB. I have no idea
how that works.

Adam
Denver, CO

------------------------------------

Yahoo! Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar