If Else

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to use an if statement to transfer data from a quote file to an order file
This is what I have so far
=IIf([Item]="A",(DLookUp("[CUSTOMER DWG # A]","
","[SIGNATURE QUOTE NUMBER]=
![SIGNATURE QUOTE NUMBER]")),""

This works but I need to add if statements for Items B,C,D & E. I can not figure out how to string the if statements together
If anyone has any suggestions it would be greatly appreciated.
 
You might want to look at the Switch Function. From the
help:
Function MatchUp (CityName As String)
Matchup = Switch(CityName = "London", "English",
CityName _
= "Rome", "Italian", CityName
= "Paris", "French")
End Function


In Your case, it would be something like:

Switch([Item]="A",DLookUp("[CUSTOMER DWG #
A]","
","[SIGNATURE QUOTE NUMBER]=
![SIGNATURE
QUOTE NUMBER]"),[Item]="B",DLookUp("[CUSTOMER DWG #
B]","
","[SIGNATURE QUOTE NUMBER]=
![SIGNATURE
QUOTE NUMBER]"))


Otherwise, the IIF statements get really complex:



IIF(Item="A",DLookup(A STRING),iif(Item="B",Dlookup(B
String),iif(ITem="C",dlookup(C STRING),"")))



Chris Nebinger
-----Original Message-----
I am trying to use an if statement to transfer data from a quote file to an order file.
This is what I have so far.
=IIf([Item]="A",(DLookUp("[CUSTOMER DWG # A]","","[SIGNATURE QUOTE NUMBER]=
![SIGNATURE
QUOTE NUMBER]")),"")
This works but I need to add if statements for Items
B,C,D & E. I can not figure out how to string the if
statements together.
 
Shawn said:
I am trying to use an if statement to transfer data from a quote file to an order file.
This is what I have so far.
=IIf([Item]="A",(DLookUp("[CUSTOMER DWG # A]","
","[SIGNATURE QUOTE NUMBER]=![SIGNATURE QUOTE NUMBER]")),"")
This works but I need to add if statements for Items B,C,D & E. I can not
figure out how to string the if statements together.
If anyone has any suggestions it would be greatly appreciated.

Write a function.

If not the solution is simple but a pain.

For a bunch of then it is easier to make sure each of them work first.

IIF( This = A, true, false)
IIF( This = B, true, false)
IIF( This = B, true, false)

Then you insert
IIF( This = A, true, IIF( This = B, true, false))
IIF( This = A, true, IIF( This = B, true, IIF( This = C, true, false)))

I once worked on a system that did newspaper ads and the "language"
consisted mainly of IF statements, that had to be nested like this....
 
You are asking a lot from this function, have you looked
into the case statement? This allows multiple options and
selections. The Help has a fairly good example and a
good VBA book will also. You can get VBA books on line
from www.netlibrary.com for free - it is the online
public library.
-----Original Message-----
I am trying to use an if statement to transfer data from a quote file to an order file.
This is what I have so far.
=IIf([Item]="A",(DLookUp("[CUSTOMER DWG # A]","","[SIGNATURE QUOTE NUMBER]=
!
[SIGNATURE QUOTE NUMBER]")),"")
This works but I need to add if statements for Items
B,C,D & E. I can not figure out how to string the if
statements together.
 
Back
Top