Access: Requery DBEngine to update User Accounts - Microsoft Community


hello all,

i have database saved in 2003 format (although, operating office 2013).  have created form allows administrator create user accounts.  form contains following list boxes:

  • user list - lists user accounts
  • group list - lists group accounts
  • assigned groups - lists groups assigned selected user

everything works fine except 1 thing.  when new user created, user list not update reflect newly created user account.  same true when user removed.  update if entire database (not form) closed , reopened.  cannot ask administrator close database program every time creates user.

i use onload event of form populate user list , group list boxes.  done using dbengine.workspaces(0).  see below.

populate (initially) list boxes:

set wrkspc = dbengine.workspaces(0)
dim straccountname string
dim grpaccountname string
dim usr user
dim grp group

list_users: ' displays user accounts
dbengine(0).databases.refresh

for each usr in wrkspc.users
if usr.name <> "creator" , usr.name <> "engine" , usr.name <> "admin" _
, usr.name <> "sysadm" , usr.name <> "" then
straccountname = straccountname & ";" & usr.name

me.user_list.rowsourcetype = "value list"
me.user_list.rowsource = straccountname
end if
next

list_groups: ' lists group accounts
each grp in wrkspc.groups
if grp.name <> "admins" , grp.name <> "users" , grp.name <> "admgroup" then
grpaccountname = grpaccountname & ";" & grp.name

me.group_list.rowsourcetype = "value list"
group_list.rowsource = grpaccountname

end if
next

what need way code on create user button able requery user , group data respective lists accurate.  came across 2 "possible" solutions. 

  • refresh dbengine using: dbengine(0).databases.refresh
  • use currentdb in lieu of dbengine

the refresh method seemed have no effect.  however, may not have used correctly.  currentdb, i unsure of how set code (or if appropriate needs.

i need done quickly.  doesn't seem should difficult.  are either of these solution or else should do? 



Office / Access / Other/unknown / Office 2013



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community