15. marts 2014 - 09:14Der er
10 kommentarer og 1 løsning
Oprette globalt modul for database
Hej alle.
Jeg har et Module1 i min database:
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If (lngX > 0) Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = vbNullString End If End Function Function fldIsEmpty(fld As Variant)
If IsNull(Len(Trim(fld))) Then 'If IsNull(fld) Or fld = "" Or IsNull(Len(fld)) Then fldIsEmpty = True Else fldIsEmpty = False End If
End Function
Jeg har ikke selv skrevet koden men bare copy/paste.
Nu vil jeg gerne at jeg kan tjekke om admin=true på nogle forskellige forms når brugeren benytter dem.
Ohh. I want a global check where fOSUsername = Init (from tblEmploy) AND Admin = True then u have access.
It's no problem for me to bind a form to a query that do just that. But if I have a form that is bound to another query, I want a global function. One I perhaps could use in "on load".
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.