?
Solved

error 2471

Posted on 2012-04-12
4
Medium Priority
?
325 Views
Last Modified: 2012-04-30
thisis a  validation i try to do in Access form

i do not know why it give me error 2471 in the form


If Me.amount > DLookup("totalvalue", "po_1", "[PO_oracle]= " & Form_GR_trans.POoraclenum)
0
Comment
Question by:mmously
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 37837129
Try this - NZ handles cases where there are no matches by returning 0 instead of null:

If Me.amount > NZ(DLookup("totalvalue", "po_1", "[PO_oracle]= " & Form_GR_trans.POoraclenum),0)

Open in new window

Ot if PO Number is text enclose it in quotes:

If Me.amount > NZ(DLookup("totalvalue", "po_1", "[PO_oracle]= '" & Form_GR_trans.POoraclenum & "'"),0)

Open in new window

Jim Dettman has an EE Article that does a very good job of explaining the DLookup function here:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html
0
 

Author Comment

by:mmously
ID: 37837157
hi  mbizup

it does not work it turn ren , i used the one related to text po
0
 
LVL 61

Expert Comment

by:mbizup
ID: 37837185
Make sure it is all on one line:
If Me.amount > NZ(DLookup("totalvalue", "po_1", "[PO_oracle]= '" & Form_GR_trans.POoraclenum & "'"),0)

Open in new window


Also try this:

If Me.amount > NZ(DLookup("totalvalue", "po_1", "[PO_oracle]= " & chr(34) & Form_GR_trans.POoraclenum & chr(34)),0)

Open in new window



If your PO number can contain single quotes, the first will fail..
0
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 37837232
Also, since you are starting this with IF, i'm assuming you have a corresponding Then:

If Me.amount > NZ(DLookup("totalvalue", "po_1", "[PO_oracle]= '" & Form_GR_trans.POoraclenum & "'"),0) Then

Open in new window

0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question