Solved

error 2471

Posted on 2012-04-12
4
323 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

695 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