Abnormal Behaviour of DLookUp. Error 2471 (1 Viewer)

khan33

New member
Local time
Today, 10:56
Joined
Apr 23, 2011
Messages
8
I have created a form and having combo box on it.

This combo box is used to make selection from table and it chooses name of the customer from customer table.

Then text box for password.

After selection password verification code runs and generate error.

If Me.txtPassword.Value = DLookup("[Password]", "Customers", "[C_Id]=" & Me.cbxCName.Value) Then

MsgBox "Password Verified. Welcome."
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtPassword.SetFocus
Exit Sub

End If
.............
I have pasted the same code in some other assignment, there its working fine.

Please Help.
 

John Big Booty

AWF VIP
Local time
Today, 16:56
Joined
Aug 29, 2005
Messages
8,263
Try;
Code:
If Me.txtPassword.Value = DLookup("[Password]", "Customers", "[C_Id]=[COLOR="Red"]'[/COLOR]" & Me.cbxCName.Value [COLOR="Red"]& "'"[/COLOR]) Then
...
 

taloker

Registered User.
Local time
Yesterday, 23:56
Joined
Mar 27, 2012
Messages
13
I am facing a problem
2 tables LU Product and Sales Point
I want the price from LU product populates when I enter the product in Sales point form
The code I have written is as below
Private Sub Price_AfterUpdate() Product = DLookup("Product", "LU Product", "Price=" & Price) End Sub It works when I enter the price and the product names populates BUT

gives error when applied gives error 2471
Private Sub combo10_AfterUpdate()
Price = DLookup("Price", "LU Product", "Product=" & Combo10)
End Sub

The combo10 is Product field in Form
 

John Big Booty

AWF VIP
Local time
Today, 16:56
Joined
Aug 29, 2005
Messages
8,263
If product is a string value then you need to use;
Code:
Price = DLookup("Price", "LU Product", "Product=[COLOR="Red"]'[/COLOR]" & Me.Combo10 [COLOR="Red"]& "'"[/COLOR])
 

taloker

Registered User.
Local time
Yesterday, 23:56
Joined
Mar 27, 2012
Messages
13
Hi
Mr John Big Booty
thanks for advice & warning I dont understand why have issued a warning to me anyhow solve my problem
If ROOM occupied from 13/3/2012 and shows OCCUPIED how to show it available automatically when the customer leaves and we enter a leaving date
 
Last edited:

missinglinq

AWF VIP
Local time
Today, 02:56
Joined
Jun 20, 2003
Messages
6,423
It solved your problem because your syntax

"Product=" & Combo10

is only correct if "Product" is defined as a Number Datatype, and apparently Product Field is defined as Text.

John's code

"Product='" & Me.Combo10 & "'")

on the other hand, is correct for a Field defined as Text.

As to your question:

"If ROOM occupied from 13/3/2012 and shows OCCUPIED how to show it available automatically when the customer leaves and we enter a leaving date"

This has absolutely nothing to do with the subject of this thread. Rules on this forum (actually on any forum) requires that you start a new thread, with an appropriate title, in order to get help with this.

Linq ;0)>
 

Users who are viewing this thread

Top Bottom