Solved

error 2471

Posted on 2012-04-12
4
320 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
  • 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

772 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