Login Access to specific form

BennyShredz

New member
Local time
Today, 04:59
Joined
Sep 4, 2013
Messages
1
forums/showthread.php?t=216646

Hi All,

I have been following the above thread but need help.

I have a table called "tblEmployees" with columns "EmpName, EmpPassword, strAccess" in my table

The login form works but I wanted the user to go to a specific form that would be designated under strAccess

I have this code but it totally wrong to what I want it to do but not sure where to start

'Close logon form and open relevent page
Dim stDocName As String
stDocName = Forms!CopyfrmLogon!cboEmployee.Column(3)
DoCmd.OpenForm stDocName

DoCmd.Close acForm, "CopyfrmLogon", acSaveNo


Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If


"stDocName = Forms!CopyfrmLogon!cboEmployee.Column(3)" - this is the line that needs to be debugged ... I need something that says open form specified in the the column "strAccess" of the "tblEmployee" tables

can anyone help?
 
Hello BennyShredz, Welcome to AWF.. :)

Is your ComboBox's RowSource..
Code:
SELECT EmpName, EmpPassword, strAccess FROM tblEmployees;
With,
ColumnCount : 3
BoundColumn : 1
ColumnWidths 2.54cm;0cm;0cm

If the above answer is yes, try Column(2) as they are ZERO based.. So technically the third column is represented as 2..

If the answer is No, change it to that ;)
 
The name of the form must be enclosed in a string
stDocName =" & Forms!CopyfrmLogon!cboEmployee.Column(2) & "
 
Poppa Smurf, you do not have to enclose them in double Quotes.. As you are assigning the value to a String..
 
Yes I know stDocName is a string and it is storing the name of the form BUT you must enclose the name of the form in double quotes when using DoCmd.OpenForm
e.g. DoCmd.OpenForm "Employees"
 
I agree that the DoCmd.OpenForm takes a String.. It can also take a String variable.. That is..
Code:
Dim strDocName As String, txtBoxStr As String
strDocName = "Employee_Frm"
txtBoxStr = Me.textBoxHasFormName
[COLOR=Green]'This method..[/COLOR]
DoCmd.OpenForm "Employees_Frm"
[COLOR=Green]'is same as
' DoCmd.OpenForm strDocName
'or even this
' DoCmd.OpenForm txtBoxStr
[COLOR=Black]
The strDocName has been assigned a normal String value.. txtBoxStr has been assigned a value from the Text box from the Form.. All roads lead to Rome..
[/COLOR][/COLOR]
 

Users who are viewing this thread

Back
Top Bottom