Click to See Complete Forum and Search --> : Need help with Nested Ifs


steve728
March 26th, 2008, 04:35 PM
I'm really having trouble using Nested Ifs in the Formula editor. I'm trying to convert MS Access VBA coding with nested if 3-4 deep. I need help with the proper use of brackets or parenthesis so that Crystal Reports XI understand what I am doing. Will someone please send me some examples for me to study?

Steve728

dglienna
March 26th, 2008, 05:06 PM
You may want to use SELECT CASE instead...

Dim crFormula As CRAXDRT.FormulaFieldDefinition
Dim crParam As CRAXDRT.ParameterFieldDefinition

crReport.DiscardSavedData

For Each crParam In crReport.ParameterFields
Select Case crParam.Name
Case "{?SortType}"
crParam.AddCurrentValue m_strSortType

End Select
Next crParam


For Each crFormula In crReport.FormulaFields
Select Case crFormula.Name
Case "{@StartDate}"
crFormula.Text = "DATE( 2001, 01, 01)"
Case "{@EndDate}"
crFormula.Text = "DATE( 2002, 03, 30)"
crFormula.Text = """All Offices"""
Case "{@DetailOrSummaryFlag}"
crFormula.Text = """" & m_strSummaryDetailFlag & """"
Case "{@Seperate}"
crFormula.Text = """FALSE"""
Case "{@SetShowWarning}"
crFormula.Text = """FALSE"""
Case Else
' do nothing
End Select
Next crFormula