Hello all,

I have the following if statements as part of a larger loop:
Code ASP:
for each x in rs.Fields
	if x.name = "HSDisplay" then
		HSDisplay = x.value
		if x.value = "true" then
			bgClass = "hs"
		end if
	end if
	if x.name = "MSDisplay" then
		MSDisplay = x.value
			if x.value = "true" then
			bgClass = "ms"
		end if
	end if
	if x.name = "CherDisplay" then
		CherDisplay = x.value
		if x.value = "true" then
			bgClass = "cher"
		end if
	end if
	if x.name = "GWDisplay" then
		GWDisplay = x.value
		if x.value = "true" then
			bgClass = "grwd"
		end if
	end if
	if x.name = "SeqDisplay" then
		SeqDisplay = x.value
		if x.value = "true" then
			bgClass = "seq"
		end if
	end if
	if x.name = "DistrictDisplay" then
		DistrictDisplay = x.value
	end if
 
	' final if statement
next

For the "final if statement" I need something to look at the other if statements before it and decide if >2 of the variables from the if statements = "true" then set bgClass = "district".

I thought about something like below, but haven't got it to work yet.
Code ASP:
for each x in rs.Fields
 
	i = 0
 
	if x.name = "HSDisplay" then
		HSDisplay = x.value
		if x.value = "true" then
			i = i + 1
			bgClass = "hs"
		end if
	end if
	if x.name = "MSDisplay" then
		MSDisplay = x.value
			if x.value = "true" then
			i = i + 1
			bgClass = "ms"
		end if
	end if
	if x.name = "CherDisplay" then
		CherDisplay = x.value
		if x.value = "true" then
			i = i + 1
			bgClass = "cher"
		end if
	end if
	if x.name = "GWDisplay" then
		GWDisplay = x.value
		if x.value = "true" then
			i = i + 1
			bgClass = "grwd"
		end if
	end if
	if x.name = "SeqDisplay" then
		SeqDisplay = x.value
		if x.value = "true" then
			i = i + 1
			bgClass = "seq"
		end if
	end if
 
	if x.name = "DistrictDisplay" then
		DistrictDisplay = x.value
		if x.value = "true" then
			i = i + 1
		end if
	end if
 
	if i >= 3 then
		bgClass = "district"
	end if
 
next

Loops, arrays, etc. Whatever I need to rewrite for it to work is fine with me. Any help would be greatly appreciated!