Programatically update Pop Up property (1 Viewer)

Capitala

Member
Local time
Today, 05:07
Joined
Oct 21, 2021
Messages
58
Good day!
I need to change the property "Pop up" for all forms depending on user name.
i.e. if username is "abc" then all forms pop up property will be "yes" otherwise, it will be set to "no"
Thanks in advance
 

Ranman256

Well-known member
Local time
Today, 00:07
Joined
Apr 9, 2015
Messages
4,339
set all form property popup = no,
put all user names into a table, for those that get popup
then get username and OPEN the form as popup:

Code:
dim bFound as boolean
vUser =  Environ("Username")
bFound =not IsNull( Dlookup("[userid]","tUsers","[UserID]='" * vUser & "'"))

if bFound then
   docmd.OpenForm "fMyform",,,,,acDialog
else
   docmd.OpenForm "fMyform"
endif
 

CJ_London

Super Moderator
Staff member
Local time
Today, 05:07
Joined
Feb 19, 2013
Messages
16,610
do you mean just the popup property or the the modal property as well? acDialog will also set the modal property which means user cannot leave the form until they close it.

If just the popup property then in addition to ranmans suggestion, in each form open event put the code

me.modal=false

a shorter version to ranmans suggestion (and corrected the *)

docmd.OpenForm "fMyform",,,,,DCount("[userid]","tUsers","[UserID]='" & vUser & "'")*-3
 

Users who are viewing this thread

Top Bottom