---
title: "förbryllande poll..."
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/6810-förbryllande-poll"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "nakoz"
published: "2000-10-06T21:55:00.000Z"
updated: "2000-10-07T15:01:00.000Z"
replies: 2
views: 155
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/6810-förbryllande-poll"
---

# förbryllande poll...

## #1 — nakoz, 2000-10-06T21:55Z

hmm... sitter med en liten poll... å allt e så grymt förbryllande med dessa variabler fram å tillbaka... ?! 
om nån orkar kolla skulle jag bli jätteglad...
240 rader... \*ehm\*

```
<% Response.Buffer = True %> 

<!-- #include file="../inc/tops1.asp" -->

<body background="../bilder/bg.gif">

<!-- #include file="../inc/topimgs1.asp" -->
<table width="710" border="0" cellspacing="0" cellpadding="7">
  <tr valign="top" align="left"> 
    <td colspan="3" height="6">
    </td>
  </tr>
  <tr> 
    <td valign="top" align="left" width="100">
<!-- #include file="../inc/menus1.asp" -->
    </td>

    <td align="center" valign="top" width="10">
	<img src="../bilder/vertikal_linje.gif" width="1" height="280">
    </td>

    <td align="left" valign="top" width="490">

<% Show = "SELECT Color FROM users WHERE ID = "&session("ID")
RecSet.Open Show, cn, adOpenStatic, adLockOptimistic %>

<% If RecSet("Color") = "Röd" Then %>
<img src="../bilder/rod/small-rosta.gif"><br><br>
<% End If %>

<% If RecSet("Color") = "Blå" Then %>
<img src="../bilder/bla/small-rosta.gif"><br><br>
<% End If %>

<% If RecSet("Color") = "Grön" Then %>
<img src="../bilder/gron/small-rosta.gif"><br><br>
<% End If %>

<% RecSet.Close %>

		<% If Request.QueryString("visa") = "resultat" Then

		show = "SELECT * FROM Poll"
		RecSet.Open show, cn, adOpenStatic, adLockOptimistic %>

		<b><% =RecSet("PollFraga") %></b>

		<%
		alt1 = RecSet("PollAlt1")
		alt2 = RecSet("PollAlt2")
		alt3 = RecSet("PollAlt3")
		alt4 = RecSet("PollAlt4")

		summa = alt1 + alt2 + alt3 + alt4 %>

ställningen just nu:<br>

<%	alt1res = "0"
		alt2res = "0"
		alt3res = "0"
		alt4res = "0"

	If RecSet("PollAlt1") => "1" Then
	alt1res = Round(alt1 / summa * 100)
	End If

	If RecSet("PollAlt2") => "1" Then
	alt2res = Round(alt2 / summa * 100)
	End If

	If RecSet("PollAlt3") => "1" Then
	alt3res = Round(alt3 / summa * 100)
	End If

	If RecSet("PollAlt4") => "1" Then
	alt4res = Round(alt4 / summa * 100)
	End If %>

<table border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="20" align="right"><%= RecSet("PollAlt1") %>&nbsp;</font></td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt1res %>" height="8">&nbsp;<% =alt1res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt2") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt2res %>" height="8">&nbsp;<% =alt2res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt3") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt3res %>" height="8">&nbsp;<% =alt3res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt4") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt4res %>" height="8">&nbsp;<% =alt4res %>%</td>
</tr>

</table>

<%= RecSet("PollAlt1") %>: <b><% =alt1res %>%</b><br>
<%= RecSet("PollAlt2") %>: <b><% =alt2res %>%</b><br>
<%= RecSet("PollAlt3") %>: <b><% =alt3res %>%</b><br>
<%= RecSet("PollAlt4") %>: <b><% =alt4res %>%</b><br>

antal svar hittills: <b><% =summa %></b>

<%	Else

		If Request.Cookies("vote").Haskeys = FALSE Then

		Response.Cookies("vote")("rost") = "voted"
		Response.Cookies("vote").Expires = Date + 1 %>

		<b><% =RecSet("PollFraga") %></b><br>

		If Request.Form("fraga") = "<%= RecSet("PollAlt1") %>" Then
		alt1 = <%= RecSet("PollAlt1") %>
		<%= RecSet("PollAlt1") %> = alt1 -- 1
		RecSet.Update

		ElseIf Request.Form("fraga") = "<%= RecSet("PollAlt2") %>" Then
		alt2 = <%= RecSet("PollAlt2") %>
		<%= RecSet("PollAlt2") %> = alt2 -- 1
		RecSet.Update

		ElseIf Request.Form("fraga") = "<%= RecSet("PollAlt3") %>" Then
		alt3 = <%= RecSet("PollAlt3") %>
		<%= RecSet("PollAlt3") %> = alt3 -- 1
		RecSet.Update

		ElseIf Request.Form("fraga") = "<%= RecSet("PollAlt4") %>" Then
		alt4 = <%= RecSet("PollAlt4") %>
		<%= RecSet("PollAlt4") %> = alt4 -- 1
		RecSet.Update
		End If

		alt4 = RecSet("PollAlt1")
		alt4 = RecSet("PollAlt2")
		alt4 = RecSet("PollAlt3")
		alt4 = RecSet("PollAlt4")
		summa = alt1 + alt2 + alt3 + alt4 %>

<b>ställningen just nu:</b><br>

<%	alt1res = "0"
		alt2res = "0"
		alt3res = "0"
		alt4res = "0"

		If RecSet("PollAlt1") => "1" Then
		alt1res = Round(alt1 / Summa * 100)
		End If

		If RecSet("PollAlt2") => "1" Then
		alt2res = Round(alt2 / Summa * 100)
		End If

		If RecSet("PollAlt3") => "1" Then
		alt3res = Round(alt3 / Summa * 100)
		End If

		If RecSet("PollAlt4") => "1" Then
		alt4res = Round(alt4 / Summa * 100)
		End If %>

<table border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="20" align="right"><%= RecSet("PollAlt1") %>&nbsp;</font></td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt1res %>" height="8">&nbsp;<% =alt1res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt2") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt2res %>" height="8">&nbsp;<% =alt2res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt3") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt3res %>" height="8">&nbsp;<% =alt3res %>%</td>
</tr>

<tr><td height="3"></td><td></td></tr>

<tr>
<td width="20" align="right"><%= RecSet("PollAlt4") %>&nbsp;</td>
<td align="left" valign="middle"><img src="bild.gif" width="<% =alt4res %>" height="8">&nbsp;<% =alt4res %>%</td>
</tr>

</table>

<%= RecSet("PollAlt1") %>: <b><% =alt1res %>%</b><br>
<%= RecSet("PollAlt2") %>: <b><% =alt2res %>%</b><br>
<%= RecSet("PollAlt3") %>: <b><% =alt3res %>%</b><br>
<%= RecSet("PollAlt4") %>: <b><% =alt4res %>%</b><br>

antal svar hittills: <b><% =summa %></b>

		<%	RecSet.Close %>

		<% Else %>

		du har redan röstat och kan därför inte rösta igen på denna fråga.<br><br>

		<a href="vote.asp?visa=resultat">aktuell ställning</a>.

<%	End If
		End If %>

    </td>
  </tr>
</table>

</body>
</html>
```

\*puh\* 

felmeddelandet blir:

Körningsfel i Microsoft VBScript fel '800a005e' 

Ogiltig användning av Null: 'Round' 

/asp/hemsidor/oldflykt2/poll/vote.asp, rad 65 

rad 65 är:

```
alt1res = Round(alt1 / summa * 100)
```

mkt tacksam för eventuell hjälp!

Permalänk: https://www.webforum.nu/p/6810

## #2 — nakoz, 2000-10-07T14:06Z

vill ingen hjälpa mig?

Permalänk: https://www.webforum.nu/p/250703

## #3 — Toonster, 2000-10-07T15:01Z

Kan det vara så att alt1 -alt4 kan ha talet 0, och kan man köra Round(0) ?

/T

Permalänk: https://www.webforum.nu/p/250704

---

Tråden på webben: https://www.webforum.nu/amne/asp/6810-förbryllande-poll
