Solved

IIF Criteria

Posted on 2001-08-09
5
620 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check a field in Access on a Timer 1 28
Limit number of characters returned to 999 9 31
access vba query parametres from a repport 1 26
Find unused columns in a table 12 67
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

713 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