You're looking at values for a number of different fields (or are they controls on a form?): [NotPaid], [CashVND] and [BA176USD_N]. Are you positive all of them have values?
To be safe, try something like:
Select Case True Case (Nz([NotPaid], False) = True) stDocName = "PREQs" Case (Nz([CashVND], 0) > 0) And (IsNull([CW_No])) stDocName = "Cash Received" Case (Nz([CashVND], 0) <= 0) stDocName = "Cash Spent" Case (Nz([BA176USD_N], 0) > 0) stDocName = "BA-176-Received" Case Else stDocName = "blanks" End Select
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"Lana" <Lana[ at ]discussions.microsoft.com> wrote in message news:2AFCF971-52EB-4883-B1FF-31731F2C31C1[ at ]microsoft.com...
[Quoted Text] > Hi all, > I've got a button which is supposed to open differrent forms depending on > some condition. I got a "Select Case" Code for it as below: > Select Case True > Case ([NotPaid] = True) > stDocName = "PREQs" > Case ([CashVND] > 0) And (IsNull([CW_No])) > stDocName = "Cash Received" > Case ([CashVND] <= 0) > stDocName = "Cash Spent" > Case ([BA176USD_N] > 0) > stDocName = "BA-176-Received" > Case Else > stDocName = "blanks" > End Select > > I tested it each case one by one and it works, but when i put them > together > - it gives me the message "Invalid use of Null". What could be wrong here? > > [CW_No] is a text field, [NotPaid] is a "Y/N", the rest are numbers (which > can have values with +/- or 0). Why it sais "Invalid use of Null"? Please, > can anybody help? > > Thank you. > Lana
|