Donorottie
01-27-2003, 10:38 AM
I'm working on getting my label to format the way I 'd like it to. The following chunk of code has a number of "If" clauses for my search any number of which could be true. So I set my display values to the variable sDisplayVal. What Im looking to do is set my label up to diplay the results of my search when certian values are true.
The format Im looking for is this:
Your Search Criteria:
Anchor: sDisplayVal
Population: sDisplayVal
etc...
Thanks for any help.
heres my code
If (Trim(txtTenants.Text) = "All tenants" And cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex) = 0 And Trim(cboPopulation.Text) = "Any population range" And Trim(cboHouseHolds.Text) = "Any number of households" And Trim(cboIncome.Text) = "Any household income range" And Trim(cboCenterSize.Text) = "Any size" And cboRegion.ItemData(cboRegion.ListIndex) = 0 And cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex) = 0 And Trim(cboCityState.Text) = "All cities and states") Then
sDisplayVal = "All Properties"
'MsgBox ("SELECT distinct centers.center_id, centers.center_path, states.state_path, centers.center_name, states.state_name, states.region_id, states.state_id FROM centers INNER JOIN states ON centers.state_id = states.state_id where center_flag=1 and state_name + center_name order by state_name, center_name")
Call SearchResults.dload("SELECT distinct centers.center_id, centers.center_path, states.state_path, centers.center_name, states.state_name, states.region_id, states.state_id FROM centers INNER JOIN states ON centers.state_id = states.state_id where center_flag=1 and state_name + center_name order by state_name, center_name")
Else
sSelectClause = BuildSelect()
'//////// ENTER THE TENANT NAME
If Trim(txtTenants.Text) <> "All tenants" Then
sJoinClause = BuildJoin("tenants")
sWhereClause = BuildWhere("tenants", txtTenants, 0)
sDisplayVal = BuildExp("tenants", txtTenants, 0)
blnAnd = True
Else
'/////// SELECT A TENANT NAME FROM THE LIST
If cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex) <> 0 Then
sJoinClause = BuildJoin("tenants")
sWhereClause = BuildWhere("anchors", cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex), 0)
sDisplayVal = BuildExp("anchors", cboAnchorTenants, 0)
blnAnd = True
Else
'/////// SELECT A POPULATION VALUE FROM THE LIST
If Trim(cboPopulation) <> "Any population range" Then
'splitVal(cboPopulation, &s_start, &s_end)
sJoinClause = BuildJoin("population")
sWhereClause = BuildWhere("population", cboPopulation, 0)
sDisplayVal = BuildExp("population", cboPopulation, 0)
blnAnd = True
Else
'/////// SELECT A HOUSEHOLD VALUE FROM THE LIST
If Trim(cboHouseHolds) <> "Any number of households" Then
'splitVal(cboHouseHolds, &s_start, &s_end)
sJoinClause = BuildJoin("households")
sWhereClause = BuildWhere("households", cboHouseHolds, 0)
sDisplayVal = BuildExp("hoseholds", cboHouseHolds, 0)
blnAnd = True
Else
'/////// SELECT A INCOME VALUE FROM THE LIST
If Trim(cboIncome) <> "Any household income range" Then
'splitVal(cboIncome, &s_start, &s_end)
sJoinClause = BuildJoin("income")
sWhereClause = BuildWhere("income", cboIncome, 0)
sDisplayVal = BuildExp("income", cboIncome, 0)
blnAnd = True
Else
'////// SELECT A CENTER SIZE FROM THE LIST
If Trim(cboCenterSize) <> "Any size" Then
'splitVal(cboCenterSize, &s_start, &s_end)
sWhereClause = BuildWhere("center_size", cboCenterSize, 0)
sDisplayVal = BuildExp("center_size", cboCenterSize, 0)
blnAnd = True
Else
'////// SELECT A REGION FROM THE LIST
If cboRegion.ItemData(cboRegion.ListIndex) <> 0 Then
sJoinClause = ") "
sWhereClause = BuildWhere("regions", cboRegion.ItemData(cboRegion.ListIndex), 0)
sDisplayVal = BuildExp("regions", cboRegion, 0)
blnAnd = True
Else
'/////// SELECT A LEASING MGR FROM THE LIST
If cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex) <> 0 Then
sJoinClause = BuildJoin("reps")
sWhereClause = BuildWhere("reps", cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex), 0)
sDisplayVal = BuildExp("reps", cboLeasingMgr, 0)
blnAnd = True
Else
'//////// SELECT A STATE FROM THE LIST
If Trim(cboCityState) <> "All cities and states" Then
'splitVal(cbocitystate, &s_start, &s_end)
sWhereClause = BuildWhere("state_id", cboCityState, 0)
sDisplayVal = BuildExp("state_id", cboCityState, 0)
blnAnd = True
Else
'/////// SELECT A CITY FROM THE LIST
If Trim(cboCityState) <> "All cities and states" Then
'splitVal(cbocitystate, &s_start, &s_end)
sWhereClause = BuildWhere("center_city_id", cboCityState, 0)
sDisplayVal = BuildExp("center_city_id", cboCityState, 0)
blnAnd = True
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
'//////// GET RID OF THE LAST 'AND'
If (Len(sWhereClause) > 0) Then
sWhereClause = " where " & sWhereClause & " and center_flag=1 "
Else
sWhereClause = sWhereClause & " where center_flag=1 "
sDisplayVal = "All Properties"
blnAnd = True
End If
'put SQL statement in form1
Form1.Text1.Text = (sSelectClause & sJoinClause & sWhereClause & sOrderClause)
Form1.Visible = True
'///////// ORDER CLAUSE
sOrderClause = BuildOrder(sOrderClause)
'//////// PERFORM SEARCH FUNCTION CONNECT ALL CLAUSES
Call SearchResults.dload(sSelectClause & sJoinClause & sWhereClause & sOrderClause)
End If
SearchResults.lblTenantName = "Your Search Criteria: " & sDisplayVal
The format Im looking for is this:
Your Search Criteria:
Anchor: sDisplayVal
Population: sDisplayVal
etc...
Thanks for any help.
heres my code
If (Trim(txtTenants.Text) = "All tenants" And cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex) = 0 And Trim(cboPopulation.Text) = "Any population range" And Trim(cboHouseHolds.Text) = "Any number of households" And Trim(cboIncome.Text) = "Any household income range" And Trim(cboCenterSize.Text) = "Any size" And cboRegion.ItemData(cboRegion.ListIndex) = 0 And cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex) = 0 And Trim(cboCityState.Text) = "All cities and states") Then
sDisplayVal = "All Properties"
'MsgBox ("SELECT distinct centers.center_id, centers.center_path, states.state_path, centers.center_name, states.state_name, states.region_id, states.state_id FROM centers INNER JOIN states ON centers.state_id = states.state_id where center_flag=1 and state_name + center_name order by state_name, center_name")
Call SearchResults.dload("SELECT distinct centers.center_id, centers.center_path, states.state_path, centers.center_name, states.state_name, states.region_id, states.state_id FROM centers INNER JOIN states ON centers.state_id = states.state_id where center_flag=1 and state_name + center_name order by state_name, center_name")
Else
sSelectClause = BuildSelect()
'//////// ENTER THE TENANT NAME
If Trim(txtTenants.Text) <> "All tenants" Then
sJoinClause = BuildJoin("tenants")
sWhereClause = BuildWhere("tenants", txtTenants, 0)
sDisplayVal = BuildExp("tenants", txtTenants, 0)
blnAnd = True
Else
'/////// SELECT A TENANT NAME FROM THE LIST
If cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex) <> 0 Then
sJoinClause = BuildJoin("tenants")
sWhereClause = BuildWhere("anchors", cboAnchorTenants.ItemData(cboAnchorTenants.ListIndex), 0)
sDisplayVal = BuildExp("anchors", cboAnchorTenants, 0)
blnAnd = True
Else
'/////// SELECT A POPULATION VALUE FROM THE LIST
If Trim(cboPopulation) <> "Any population range" Then
'splitVal(cboPopulation, &s_start, &s_end)
sJoinClause = BuildJoin("population")
sWhereClause = BuildWhere("population", cboPopulation, 0)
sDisplayVal = BuildExp("population", cboPopulation, 0)
blnAnd = True
Else
'/////// SELECT A HOUSEHOLD VALUE FROM THE LIST
If Trim(cboHouseHolds) <> "Any number of households" Then
'splitVal(cboHouseHolds, &s_start, &s_end)
sJoinClause = BuildJoin("households")
sWhereClause = BuildWhere("households", cboHouseHolds, 0)
sDisplayVal = BuildExp("hoseholds", cboHouseHolds, 0)
blnAnd = True
Else
'/////// SELECT A INCOME VALUE FROM THE LIST
If Trim(cboIncome) <> "Any household income range" Then
'splitVal(cboIncome, &s_start, &s_end)
sJoinClause = BuildJoin("income")
sWhereClause = BuildWhere("income", cboIncome, 0)
sDisplayVal = BuildExp("income", cboIncome, 0)
blnAnd = True
Else
'////// SELECT A CENTER SIZE FROM THE LIST
If Trim(cboCenterSize) <> "Any size" Then
'splitVal(cboCenterSize, &s_start, &s_end)
sWhereClause = BuildWhere("center_size", cboCenterSize, 0)
sDisplayVal = BuildExp("center_size", cboCenterSize, 0)
blnAnd = True
Else
'////// SELECT A REGION FROM THE LIST
If cboRegion.ItemData(cboRegion.ListIndex) <> 0 Then
sJoinClause = ") "
sWhereClause = BuildWhere("regions", cboRegion.ItemData(cboRegion.ListIndex), 0)
sDisplayVal = BuildExp("regions", cboRegion, 0)
blnAnd = True
Else
'/////// SELECT A LEASING MGR FROM THE LIST
If cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex) <> 0 Then
sJoinClause = BuildJoin("reps")
sWhereClause = BuildWhere("reps", cboLeasingMgr.ItemData(cboLeasingMgr.ListIndex), 0)
sDisplayVal = BuildExp("reps", cboLeasingMgr, 0)
blnAnd = True
Else
'//////// SELECT A STATE FROM THE LIST
If Trim(cboCityState) <> "All cities and states" Then
'splitVal(cbocitystate, &s_start, &s_end)
sWhereClause = BuildWhere("state_id", cboCityState, 0)
sDisplayVal = BuildExp("state_id", cboCityState, 0)
blnAnd = True
Else
'/////// SELECT A CITY FROM THE LIST
If Trim(cboCityState) <> "All cities and states" Then
'splitVal(cbocitystate, &s_start, &s_end)
sWhereClause = BuildWhere("center_city_id", cboCityState, 0)
sDisplayVal = BuildExp("center_city_id", cboCityState, 0)
blnAnd = True
Else
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
'//////// GET RID OF THE LAST 'AND'
If (Len(sWhereClause) > 0) Then
sWhereClause = " where " & sWhereClause & " and center_flag=1 "
Else
sWhereClause = sWhereClause & " where center_flag=1 "
sDisplayVal = "All Properties"
blnAnd = True
End If
'put SQL statement in form1
Form1.Text1.Text = (sSelectClause & sJoinClause & sWhereClause & sOrderClause)
Form1.Visible = True
'///////// ORDER CLAUSE
sOrderClause = BuildOrder(sOrderClause)
'//////// PERFORM SEARCH FUNCTION CONNECT ALL CLAUSES
Call SearchResults.dload(sSelectClause & sJoinClause & sWhereClause & sOrderClause)
End If
SearchResults.lblTenantName = "Your Search Criteria: " & sDisplayVal