UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Global Declaring Issue, Access 2013    
 
   
gint32
post Apr 4 2019, 09:24 PM
Post#1



Posts: 368
Joined: 8-May 09
From: Australia


Seems like a silly question, so don't laugh I am trying to make a variable global which seems straight enough to most

I want the logged on user to remain the logged on user throughout the entire "ACCDB" or ACCDR, so I have read from heaps of sources that you just need to call it

so, I have tried inserting the below declaring but I get error when compiling and have no idea why!
CODE
Public loggedonuser As String = Environ("UserName")'''

or
CODE
Constant loggedonuser = Environ("UserName")


So my question ..is : where does the above need to reside (meaning where can I place this) so its available everywhere throughout the DB, or do I have to copy this into every form at the top of the code within "Microsofts Access Class Headers" or does it have to go into each header within each "Module", surely and hopefuly not and theirs a far simpler way that I can just insert it in one place.

Currently, I have to keep calling Call a Mod that I created from the code within each form. which I think is just not right!

thanks for reading smile.gif
This post has been edited by gint32: Apr 4 2019, 09:25 PM
Go to the top of the page
 

Posts in this topic
- gint32   Global Declaring Issue   Apr 4 2019, 09:24 PM
- - sumosoftware   This is a basic example, please edit as required. ...   Apr 4 2019, 09:41 PM
|- - gint32   great where does it go to make avail to all forms....   Apr 4 2019, 09:43 PM
|- - sumosoftware   just pop the code in a new code module, I like to ...   Apr 4 2019, 09:49 PM
|- - gint32   So back to my OP, do I have to call this from each...   Apr 4 2019, 10:25 PM
|- - sumosoftware   Yep set gUserName once and this works across the w...   Apr 4 2019, 10:33 PM
||- - gint32   Will do and thanks, for the quick response.   Apr 4 2019, 10:36 PM
||- - gint32   Sorry to be a pest, but after inserting as you sug...   Apr 4 2019, 11:06 PM
||- - MadPiet   Did you declare it somewhere else too? A global va...   Apr 4 2019, 11:13 PM
||- - gint32   thanks very much for your help, I do a search and ...   Apr 4 2019, 11:18 PM
||- - gint32   I done a find and replace for all instances of : ...   Apr 4 2019, 11:27 PM
||- - sumosoftware   Try from the vba window menu clicking Debug > C...   Apr 5 2019, 12:46 AM
||- - gint32   QUOTE try VBA Compile. thanks this is what I have ...   Apr 5 2019, 01:07 AM
||- - isladogs   Suggest you make a backup then do a global search ...   Apr 5 2019, 04:05 AM
||- - AlbertKallal   Ok, Your global declare is to be placed in a sta...   Apr 5 2019, 10:54 AM
||- - gint32   QUOTE Your global declare is to be placed in a sta...   Apr 5 2019, 06:35 PM
|- - theDBguy   Hi. Pardon me for jumping in but if you’re using E...   Apr 4 2019, 10:36 PM
|- - sumosoftware   very true theDBguy as the username is very simple ...   Apr 4 2019, 10:56 PM
|- - gint32   QUOTE re-dbguy.. using Environ(“Username”), You ...   Apr 5 2019, 12:05 AM
- - TenaciousCoder   I just skim-read this thread and I’m blown away wi...   Apr 7 2019, 05:09 PM
- - theDBguy   Hi Tenecious. Welcome back to the forum! Thank...   Apr 7 2019, 05:26 PM



Custom Search


RSSSearch   Top   Lo-Fi    7th December 2019 - 01:42 AM