Can you see the problem?
No double-quote after the username. Add it, using the same syntax as already shown to you.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to make Login Form Using DCount and LookUp functions
My table has the following field LoginID, UserName, Password, Level and Description
Form has:
Combobox Named: "txtUser" bound column is 1 (LoginID) and I hide it by sitting Column Widths by 0
TextBox Named "txtPass"
Login Button and I use If function with AND but it does not work, access alway open the main form to me he did not use "else"
If
I did this DCount("LoginID","LoginT","UserName=[txtUser]" And "Password=[txtPass]")
I did this DCount("LoginID","LoginT","UserNamer=[txtPass]") And ("Password","LoginT","Password=[txtPass]")
I did this DCount("LoginID","LoginT","UserNamer=[txtPass]" And "Password","LoginT","Password=[txtPass]")
I did this DCount("Password","LoginT","Password=[txtPass]")
they did not work
if the txtUser and txtPass Mach and his Level is 1 as admin open the Main form as edit, else as Read only
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Can you see the problem?
No double-quote after the username. Add it, using the same syntax as already shown to you.
Try
DCount("LoginID","LoginT","[UserName]='" & [txtUser] & "' AND [Password]='" & [txtPass] & "'")
I see you should want to build a multi-user application because of needing a login form.
According to the restrict of VBA and depends on macro,it looks not flexible and uneasy.
So , if possible,web architecture( like asp+mdb ) is not a bad choice.