Solved

IIF Criteria

Posted on 2001-08-09
5
617 Views
Last Modified: 2012-06-22
Hi,

I need to create a make-table query that changes the value of a field titled Barcode depending upon the value stored within SP_DEFAULT_SA_EXP_END_DATE, which is a Date/Time field.

The expression I have entered into the criteria of the Barcode field is as follows. When run however it causes no data to be entered into any fields at all.

IIf([SP_DEFAULT_SA_EXP_END_DATE] Is Not Null,[SB_REF] & "/" & [SP_REF],[SB_REF])

Can anyone offer any suggestions?

Thanks,
David.
0
Comment
Question by:DSE
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:TheMek
ID: 6367497
Hi David,

try it like this instead:
IIf(IsNull([SP_DEFAULT_SA_EXP_END_DATE])=False,[SB_REF] & "/" & [SP_REF],[SB_REF])

Hope this helps,
   Erwin
0
 
LVL 6

Accepted Solution

by:
cjswimmer earned 30 total points
ID: 6367499
you don't put that in the criteria section of the barcode field, you list it AS the new barcode field.  Put in into the SQL statement like:

SELECT INTO tblNewTable
Field1, Field2, IIf([SP_DEFAULT_SA_EXP_END_DATE] Is Not Null,[SB_REF] & "/" & [SP_REF],[SB_REF]) AS NewBarcodeField
FROM tblOldTable

in the table that is produced you will have the results you wanted in the field 'NewBarcodeField'.  You can change it to whatever name you want.

cjswimmer
0
 
LVL 5

Expert Comment

by:TheMek
ID: 6367581
Good point cjswimmer, I missed that he had put it in the criteria field instead of using it as an expression ;-)
0
 
LVL 6

Expert Comment

by:cjswimmer
ID: 6367817
sorry, wrong syntax:

SELECT Field1, Field2,
 IIf([SP_DEFAULT_SA_EXP_END_DATE] Is Not Null,[SB_REF] & "/" & [SP_REF],[SB_REF]) AS
NewBarcodeField
INTO tblNewTable FROM tblOldTable
0
 

Author Comment

by:DSE
ID: 6373553
Hi,

Thanks for your suggestions...the SQL statement worked first time...saved me a lot of time and headaches! :-)

Cheers,
David.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Syntax Error in Query 7 31
is there a opposite on ON CURRENT in ms/access 15 32
MS Access Tables Linking 6 42
Prevent use of Microsoft Office application 9 53
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

920 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

14 Experts available now in Live!

Get 1:1 Help Now