mysql - User management in Microsoft Access 2013 databases -


i building system using microsoft access 2013 uses mysql backend. trying figure out way kind of basic user management, ideally in such way users have "log in" when launch database, , username accessible system while using it. i've tried searching solutions, of them tell me use office 365 or sharepoint, not options @ moment. have idea of how accomplish this? in advance!

i recommend building own user storage , login system. you'll need create own users table (in mysql in case), make forms manage users, make login form, , write code control login process.

logging in consists of checking kind of credentials type in against existing data in users table. can in access dlookup or dcount statements end using dao or ado recordset instead since pull out more 1 value user's table , write things right away, lastlogin datetime, lastlogin computername, etc.

i wrote example database can download here. needs rewrite. i've changed quite few of practices since jan, 2011. give me year , need rewrite.

i program login form user enters initials , password. if go route need have unique index setup on initials field prevent duplicates. if you're going have lot of users need use username instead, still theoretically users initials.

here's code authenticate user. aware far secure. assumes passwords stored in plain text. users theoretically try sql inject here because i'm not use parametrized query or stripping out special characters input such @ or ;.

private function authenticateuser() boolean      dim sinitials string     dim spassword string     sinitials = trim(nz(me.txtinitials, ""))     spassword = trim(nz(me.txtpassword, ""))      if sinitials = "" or spassword = ""         'logging in blank passwords not allowed         authenticateuser = false         exit function     end if      if dcount("employeeid", "tblemployees", "[initials] = '" & replace(sinitials, "'", "''") & "' , password = '" & replace(spassword, "'", "''") & "'", true) = 0         msgbox "invalid credentials."         authenticateuser = false         exit function     else         dim rs new dao.recordset         dim ssql string         ssql = "select * tblemployees initials = '" & replace(sinitials, "'", "''") & "'"         set rs = currentdb.openrecordset(ssql)         if not (rs.eof , rs.bof)             'config instance of user defined type. class object.             config.userinitials = rs("initials")             config.userfullname = rs("employeename")             config.userid = rs("employeeid")             rs.edit             rs("lastlogindatetime") = now()             rs("lastlogincomputer") = "function required computer name"             rs("progversion") = "your program version number"             rs("currentdbpath") = left(currentproject.path & "\" & currentproject.name, 254)             rs.update         end if         rs.close         set rs = nothing         authenticateuser = true     end if  end function 

in applications use global object, in case instance of user defined type, call config. store kind of application runtime related settings in there duration of runtime of application. of course object gets destroyed when user closes out of application or when code reset happens (which cannot happen in access runtime, happen during development). use class object instead of user defined type. or use individual global variables everything, don't recommend (that's used do). user defined type allows group global variables , gives easy way refer them in code during design time typing in config., brings every option using intellisense (assuming have enabled).

if want settings survive code reset, need use tempvars. tempvars became available access 2007. not use them (contrary example database) because not typed. there's no intellisense correct tempvar , can technically refer tempvar doesn't exist , access won't throw error. think tempvars dictionary object of it's shortcomings, , single benefit of surviving code reset. can imagine storing connection string in there, wonder if it's worth using tempvars @ all. if code reset happens, entire application needs reloaded anyway since setup lot of global objects , variables when application first opens , user first logs in.

fyi, in previous versions of access there user security built in. think microsoft discontinued starting in 2007. never used didn't miss when got discontinued.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -