Тёмный
No video :(

How to Use Iif in Microsoft Access 

Sean MacKenzie Data Engineering
Подписаться 12 тыс.
Просмотров 7 тыс.
50% 1

In this episode, we look at how to use the Iif, or iif function in Microsoft Access to allow us a very quick if-then return value in our queries, forms, reports, and VBA code. The Iif function is very powerful, and will help you get values when you need "if condition is true then return this, otherwise return that"!
Related Videos:
Getting Started with MS Access Visual Basic for Applications - VBA Code-Behind and Modules
• Getting Started with M...
VBA MsgBox - How to use message boxes in MS Access
• VBA MsgBox - How to us...
How to Use a Do Until Loop in MS Access VBA
• How to Use a Do Until ...
How to Use Iif in Microsoft Access
You are watching this video now!
How to Use the Replace Function in Microsoft Access
• How to Use the Replace...
How to Use Nz in Microsoft Access to Handle Null and Empty Values
• How to Use Nz in Micro...
Iif, If Then Else, and Select Case in MS Access
• Iif, If Then Else, and...
How to Use DLookup in Microsoft Access
• How to Use DLookup in ...
How to Create and Configure a Custom Pop-Up Form in MS Access
• How to Create and Conf...
Interested in transforming your career or finding your next gig?
system.billzon...
Want my team to do a project for you? Let's get to it!
system.billzon...
Want to get access to premium content made just for you and have a chat with me? Find me on Patreon :
/ mackenziedataengineering
Demo of my BZ RDP Cloaker:
www.patreon.co...
Want to work with me 1:1? Contact me today and book your free 20 min consultation!
Contact form you can find at www.mackenziema...
Follow me on social media:
/ mackenziedataanalytics
/ seamacke
/ seamacke
/ seamacke
/ psmackenzie
Get Microsoft Office including Access:
click.linksyne...
Got a RU-vid Channel? I use TubeBuddy, it is awesome. Give it a try:
www.tubebuddy....

Опубликовано:

 

27 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 19   
@miles6875
@miles6875 Год назад
Simple and extremely useful. This is a gem, thanks Sean
@seanmackenziedataengineering
Thanks for the feedback! cheers
@serdip
@serdip 27 дней назад
Thank you for posting this very helpful video. I was surprised that the Iif() function in the form assigned to the third textbox control doesn't raise an error when the form first opens. Since the fields upon which it depends are initially Null, shouldn't the condition, i.e. first argument of the Iif() function evaluate to Null? I guess Null is equivalent to False then. If you have a situation where several nested If() functions are being used, why not use an in line Switch() statement instead? I think it's important to mention that both the and arguments of the Iif() function are *always* evaluated. So if those arguments are something more than simple constants, e.g. functions or complex expressions, they might fail if variables or fields referenced by them are Null. And if these arguments perform resource intensive operations such as drilling into a table, the performance of the code may suffer as a result. Thank you kindly.
@seanmackenziedataengineering
@seanmackenziedataengineering 25 дней назад
You are almost right; In this case during the evaluation of expressions, MS Access allows comparison operators with Null (unlike some other languages). Further, in some cases with expressions (for example with Eval), you must use [FieldName] = Null or [FieldName] Null instead of using an IsNull function. So, the expression that evaluates Null values in controls in this example is correct, as it works with MS Access expressions.
@garythedo
@garythedo 2 года назад
Your videos are great-thank you for making them! Suggestion for a future video would be example of build using custom events, i.e. using WithEvents
@seanmackenziedataengineering
@seanmackenziedataengineering 2 года назад
Thanks for the idea! I'll put that on my list.
@abuhammad8652
@abuhammad8652 10 месяцев назад
Very helpfull thank you sir
@seanmackenziedataengineering
@seanmackenziedataengineering 10 месяцев назад
Most welcome!
@stanTrX
@stanTrX 7 месяцев назад
Dear Sean, is it possible to use checkbox value from form to the query? Do you have a video about it?
@seanmackenziedataengineering
@seanmackenziedataengineering 7 месяцев назад
Yes, you can do it. Just remember that the checkbox can be tri-state. This means it can be -1, 0, or Null. So you might use Nz with that in a Where clause for example: Where Nz(Forms!frmMain!chkShow, 0) = 0 or something like that. Nz changes Null to a 0 in this example
@dbdata9836
@dbdata9836 2 года назад
thanks
@seanmackenziedataengineering
@seanmackenziedataengineering 2 года назад
Glad that worked!
@satyabanukil779
@satyabanukil779 10 месяцев назад
Sir, approaching you again and again for a long time. Hope you are fine. This time I have a multilined code with "If" condition. My code looks like this. There are few more line in between, which I have ignored to make it more short and understandable. Line 1 : "if VPOS = "FAV" and Cont "1C" or Cont "1D" and Mode = " " and Result = "=" then NS1 = 90 end if Line 2 : "if VPOS = "FAV" and Cont "1C" or Cont "1D" and Mode = " " and Result = "+1" then NS1 = 110 end if The code always executes my last line of argument and ignore all other previous line in all cases. VPOS, Cont, Mode, Result and NS1 are field names. Is there any way to overcome it. Shall be grateful. Regards.
@seanmackenziedataengineering
@seanmackenziedataengineering 10 месяцев назад
Interesting problem.. you probably need to add brackets to your Cont evaluation, ie: if VPOS = "FAV" and (Cont "1C" or Cont "1D") and Mode = " " and Result = "=" otherwise many other cases will result to true, like you are seeing.
@satyabanukil779
@satyabanukil779 10 месяцев назад
Thnx for your kind response Sir. Now it's late night here. Shall definitely explore your advice tomorrow and get back. Regards.
@satyabanukil779
@satyabanukil779 10 месяцев назад
Thnx Sir. Your advice worked like a magic. Grateful to you once again Sir. Didn't have any idea that putting argument within a bracket could make things so understandable to the system.
@seanmackenziedataengineering
@seanmackenziedataengineering 10 месяцев назад
@@satyabanukil779 Glad that worked! cheers
@rincondeolocuilta
@rincondeolocuilta 2 года назад
Nice!
@seanmackenziedataengineering
@seanmackenziedataengineering 2 года назад
Thanks!
Далее
How to Use the Replace Function in Microsoft Access
9:50
How to Use DLookup in Microsoft Access
15:48
Просмотров 19 тыс.
Кого из блогеров узнали?
00:10
Просмотров 383 тыс.
Whoa
01:00
Просмотров 35 млн
Коротко о моей жизни:
01:00
Просмотров 435 тыс.
How to Handle VBA Errors in MS Access
13:01
Просмотров 4,7 тыс.
IIF statement in a Query
7:38
Просмотров 3,3 тыс.
Кого из блогеров узнали?
00:10
Просмотров 383 тыс.