Hi ppl. I am having trouble with a login form. When i click the btnConfirmar, after having both Login and Password it gives me an error 2471: The expression you entered as a query parameter produced this error: the error is whatever value is in the cboLogin.
Anyone has an ideia of what the solution might be?
As an attachment there is a pic of the form.
Any help would be great, Slaxer13. - Public UtzID As Long
-
-
Private Sub btnConfirmar_Click()
-
-
'Confere se foi escolhido um Login
-
-
If IsNull(Me.cboLogin) Or Me.cboLogin = "" Then
-
MsgBox "Tem de escolher um LOGIN", vbOKOnly, "Campo Obrigatório"
-
Me.cboLogin.SetFocus
-
Exit Sub
-
End If
-
-
'Confere se a password foi introduzida
-
-
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
-
MsgBox "Tem de inserir PASSWORD", vbOKOnly, "Campo Obrigatório"
-
Me.txtPassword.SetFocus
-
Exit Sub
-
End If
-
-
'Confere se a password é igual ao do login na tblUtilizador
-
-
If Me.txtPassword.Value = DLookup("Password", "tblUtilizador", "[Cod_Utilizador]=" & Me.cboLogin.Value) Then
-
-
UtzID = Me.cboLogin.Value
-
-
'Fecha o frmLogin e abre o programa
-
-
DoCmd.Close acForm, "frmLogin", acSaveNo
-
DoCmd.OpenForm "frmUtente"
-
-
Else
-
MsgBox "Password Errada! Tente Outra Vez", vbOKOnly, _
-
"Password Errada"
-
Me.txtPassword.SetFocus
-
End If
-
-
'Se o utilizador escrever a password mal três vezes a base de dados é fechada
-
-
intLogonAttempts = intLogonAttempts + 1
-
If intLogonAttempts > 3 Then
-
MsgBox "Não tem acesso á basa de dados. Contacte o Administrador.", _
-
vbCritical, "Acesso Restrito!"
-
Application.Quit
-
End If
-
-
End Sub
-
-
Private Sub cboLogin_AfterUpdate()
-
-
Me.txtPassword.SetFocus
-
-
End Sub
5 1111
Slaxer,
upon which line of code is the error generating itself?
You probably misspelled the field name used in the criteria for the Dlookup. Check the spelling of this field:[Cod_Utilizador]
Jim
Is the value of your cboLogin a text value or integer?
If it is a text value then, line 23 should be: - If Me.txtPassword.Value = DLookup("Password", "tblUtilizador", _
-
"[Cod_Utilizador] = '" & Me.cboLogin & "'") Then
I hope this helps!
Thanks for the reply. I found the problem. - If Me.txtPassword.Value = DLookup("[Password]", "tblUtilizador", "[Login]='" & Me.cboLogin.Value & "'") Then
The code should be this way (the changes are bold and italic). My bad. But thanks anyway ;)
Cheers, Slaxer13
I see brilliant minds think alike! Glad we could help!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: John Wolrehammer |
last post by:
After the user login in i want to close the login form. I
can close it but it also closes the whole application.
Can anyone help.
|
by: JPSutor |
last post by:
I have a login form, that if successfully answered, launches another
form. The problem is that the login form remains even after I show the
main form. How do I get rid of the login form?
|
by: David Krussow |
last post by:
Just wondering if/how it would be possible to display a variable string on
the login form - where the string varies depending on the form the user
attempted to access.
To clarify, an...
|
by: Agnes |
last post by:
My login form will call a main form with menu
in my button_OK click event
>dim frmMain as new mainform
>frmMain.show()
>Me.dispose()
The login form didn't close by itself, Please help.. Thanks
|
by: Bob |
last post by:
I haver a user login form (winforms app using vs2005 in VB.NET). After
succesfull validayion of user I want to open a first form and close the
loging form that was used, If I write
If...
|
by: Ronald S. Cook |
last post by:
It's been longer that I remember since writing windows (not web) apps.
1) I want to load a main form
2) User clicks login button which brings up login form (on top of main form)
3) Upon...
|
by: knot2afrayed |
last post by:
I am trying to fix error- object does not exist- I want it possible to
allow object not to exist.
I am writing a script on a page that may or may not include a login
form. For example-after a...
|
by: naharol |
last post by:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...
|
by: matheussousuke |
last post by:
I dont get any error message, it's simple, some pages works ok, they simply show "Welcome, 'username'.
LOGOUT (link)"
The same as Bytes, when u login, u dont see the form anymore, u just see a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |