Hello,
I'm newbie to all these "programming" excel and access things, so i needed some sort of database. I look at some tutorials, find some templates on internet and just edit it to fit my need's. I have the following problem:
I created Login Form
Code:
I want to connect some entities and account so when some1 leave comment I can see who was logged at that moment.
At the moment it looks like this:
I also want to make few Value List's witch will be linked with comment in form:
Account name; Date; Time; 1st Value List; 2nd Value List; Comment
Code I'm using for comment history to link it with new comment:
I tryed with this code:
It was a failure
Maybe I havnt post enough information, if anything else is needed just say.
I'm newbie to all these "programming" excel and access things, so i needed some sort of database. I look at some tutorials, find some templates on internet and just edit it to fit my need's. I have the following problem:
I created Login Form
Code:
Code:
Option Compare DatabasePrivate Sub Command1_Click()
Dim User As String
Dim UserLevel As Integer
Dim TempPass As String
Dim ID As Integer
Dim UserName As String
Dim TempID As String
If IsNull(Me.txtUserName) Then
MsgBox "Unesi Username", vbInformation, "Username neophodan"
Me.txtUserName.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "Unesi Password", vbInformation, "Password neophodan"
Me.txtPassword.SetFocus
Else
If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin = '" & Me.txtUserName.Value & "' And UserPassword = '" & Me.txtPassword.Value & "'"))) Then
MsgBox "Pogrešan Username ili Password"
Else
TempID = Me.txtUserName.Value
UserName = DLookup("[UserName]", "tblUser", "[UserLogin] = '" & Me.txtUserName.Value & "'")
UserLevel = DLookup("[UserSecurity]", "tblUser", "[UserLogin] = '" & Me.txtUserName.Value & "'")
TempPass = DLookup("[UserPassword]", "tblUser", "[UserLogin] = '" & Me.txtUserName.Value & "'")
UserLogin = DLookup("[UserLogin]", "tblUser", "[UserLogin] = '" & Me.txtUserName.Value & "'")
DoCmd.Close
If (TempPass = "password") Then
MsgBox "Please change Password", vbInformation, "New password required"
DoCmd.OpenForm "frmUserinfo", , , "[UserLogin] = " & UserLogin
Else
'open different form according to user level
If UserLevel = 1 Then ' for admin
DoCmd.OpenForm "frmAdminPanel"
Else
DoCmd.OpenForm "UserForm"
End If
End If
End If
End If
End Sub
At the moment it looks like this:
I also want to make few Value List's witch will be linked with comment in form:
Account name; Date; Time; 1st Value List; 2nd Value List; Comment
Code I'm using for comment history to link it with new comment:
Code:
=ColumnHistory([RecordSource];"Comments";"[ID]=" & Nz([ID];0))
Code:
=ColumnHistory([RecordSource];"ValList1";"ValList2";"Comments";"[ID]=" & Nz([ID];0))
Maybe I havnt post enough information, if anything else is needed just say.