View Full Version : question/help


rkrause
05-21-2008, 12:00 PM
Heres my query, what i wanted looked at is Iif line in my query.

strSQL = "SELECT tblDelinAcctListFormData_Temp.Letterhead, tblPDInv_Temp.CustId, tblPDInv_Temp.CustName, tblPDInv_Temp.OnHold, tblPDInv_Temp.Contact, " & _
"tblPDInv_Temp.Coll_Ext, tblPDInv_Temp.DateAcctOnHold, tblPDInv_Temp.Notes, tblPDInv_Temp.LastDateContactedLDC, tblPDInv_Temp.Coll_FollowupDate, tblPDInv_Temp.PaymentMethod, " & _
"tblPDInv_Temp.Phone, tblPDInv_Temp.Fax, tblDelinAcctListFormData_Temp.Region, tblDelinAcctListFormData_Temp.ActStat, " & _
"tblDelinAcctListFormData_Temp.NumPastDue, tblDelinAcctListFormData_Temp.TotDue, Iif([tblPDInv_Temp.invstat] = 16, [tblDelinAcctListFormData_Temp.TotDue] - [tblPDInv_Temp.InvAmt]) AS NewAmt " & _
"FROM tblPDInv_Temp " & _
"INNER JOIN tblDelinAcctListFormData_Temp " & _
"ON tblPDInv_Temp.CustId = tblDelinAcctListFormData_Temp.CustId " & _
"WHERE (((tblPDInv_Temp.CustId)='" & strCustID & "') AND (([InvAmt]-[AmtPaid])<>0));"


heres how the data is displayed on the form, except the "NewAmt" wont show up, anyone know why?

txtProgramType = !Letterhead
txtCustID.Value = !CustID
txtCustName.Value = !CustName
txtContact.Value = !Contact
txtPhone.Value = !Phone
txtFax.Value = !Fax
txtRegion.Value = !Region
txtTotalDue.Value = !TotDue
txtActStat.Value = !ActStat
txtColl_Ext.Value = !Coll_Ext
txtDateAcctOnHold.Value = !DateAcctOnHold
txtNotes.Value = !Notes
txtLastDateContacted.Value = !LastDateContactedLDC
txtCollFollowupDate.Value = !Coll_FollowupDate
txtPymtMethod.Value = !PaymentMethod
txtNewTotal.Value = !NewAmt

georgedwilkinson
05-21-2008, 12:19 PM
Because there are no rows in the result set in which [tblPDInv_Temp.invstat] = 16. To make sure, include another column in the result set:
[tblPDInv_Temp].[invstat] '(Please note the placement of the brackets)

This should give you a good clue what is wrong. When you've troubleshot and fixed the problem, remove the column.

raskew
05-21-2008, 12:36 PM
An Iif() statement requires both a result if true and a result if false. Can't see where you've included the false side of the function, e.g.
iif(x = 16, "true side", "false side").

Bob