Solved

IIF Criteria

Posted on 2001-08-09
5
621 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
[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
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
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…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

710 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