Solved

error 2471

Posted on 2012-04-12
4
319 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
Comment Utility
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
Comment Utility
hi  mbizup

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

Expert Comment

by:mbizup
Comment Utility
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
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup 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.

Join & Write a Comment

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…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now