Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

msgbox permission error

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
Hey gang,

I am trying to pop up a message box using the following code;

varDelete = MsgBox ("Are you sure you want to delete " & request.querystring("company") & "?",52,"Record Delete Warning")

and I get a server error;

Microsoft VBScript runtime (0x800A0046)
Permission denied: 'MsgBox'

What on earth is wrong????? and why?

BTW, the same thing happens if I strip it back to a bare minimum msgbox without the variable.

Always amazes me how I can solve seemingly complex stuff, but these little things drive me crazy :eek:) Steve Davis
hey.you@hahaha.com.au
 
Most pages I've seen use a button with an OnClick Event in the client side script and doing a "Window.Submit"???? if the answer is "Y" i.e the script writtem to the page where the user specifies delete. I have not had to use client side script (I mostly access other sites like a credit bureau withe the VB WebBrwoser Control).
 
Yeah, I solved it by just tossing to a new page with a confirm and then deletes on a "yes"

A msgbox would have been tidier theough ;o)

Thanks for that, solved something that has niggled for ages. Steve Davis
hey.you@hahaha.com.au
 
Yeah, when they come after me to convert my "open new customers/accounts/atm cards/autotransfers/etc while asynchronously checking checking credit bureaus, OFAC frozen assets, zip codes on the internet and his/her mama VB desktop app" to the intranet, I'll be looking at Client Side Script, but golly gee...guess what? That darm VB desktop app just "snaps" the screens so fast that the users can't be moved to an intrnet app with dynamite.
 
you CAN use the msgbox to confirm the delte of a file by sending the confirmation script to the client side. If you just write it client side and substitute in the variables, it should work. I have used this option many times!! works nice!
-Ovatvvon :-Q
 
Yeah, no problem John,

Let's assume that you have a bunch of email addresses in a database. You have them displayed on a page in order of the database. You make them a link so when someone clicks on it, they are selecting they want to delete that email address. (for simplicities sake).

Then, on click, you'll have it run the vbscript, which will confirm you want to delete that one. It will pass that database object to the script for processing.

You have a database, it's called mydb.mdb. fields in it are userPK, userName, and userEmail.

==============================================================



<html>
<head>
<title>My Sample Page</title>

<script language='VBScript'>
<!--
function deleteIt(pk, name)
Dim yesNo
yesNo = MsgBox(&quot;Are you sure you want to delete &quot; & name & &quot;'s email address?&quot;, vbYesNo+vbQuestion, &quot;Delete?&quot;)
If yesNo = vbYes then
document.location.href = &quot;deleteEmailPage.asp?userID=&quot; & pk
end If
end function
-->
</script>

</head>
<body>

<%
Dim conn, connString, rs, sql

sql = &quot;SELECT * FROM mydbTable;&quot;
Set conn = Server.CreateObject(&quot;ADODB.connection&quot;)
connString = &quot;DRIVER = {Microsoft Access Driver (*.mdb)};DBQ=&quot; & Server.MapPath(&quot;/db/mydb.mdb&quot;) & &quot;;&quot;
conn.Open connString
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open sql, conn, 0, 1

Do while not rs.EOF
Response.write(&quot;Name = <DIV ID='&quot; & rs(&quot;userName&quot;) & &quot;' style='cursor:hand;' onClick=&quot;&quot;deleteIt(&quot; & rs(&quot;userPK&quot;) & &quot;, '&quot; & rs(&quot;userName&quot;) & &quot;')&quot;&quot;>&quot; & rs(&quot;userName&quot;) & &quot;</DIV><BR>&quot;)
Response.write(&quot;Email = <DIV ID='&quot; & rs(&quot;userName&quot;) & &quot;1' style='cursor:hand;' onClick=&quot;&quot;deleteIt(&quot; & rs(&quot;userPK&quot;) & &quot;, '&quot; & rs(&quot;userName&quot;) & &quot;')&quot;&quot;>&quot; & rs(&quot;userEmail&quot;) & &quot;</DIV><BR><BR>&quot;)
rs.MoveNext
Loop

rs.Close
conn.Close
Set rs = nothing
Set conn = nothing
%>

</body>
</html>



Hope this helps...

-Ovatvvon :-Q
 
Yes.

So was the problem I was having (look at the original message) because I was trying to use the querystring value in the msgbox????

That is the only difference I can see in what you posted and what I was trying. Steve Davis
hey.you@hahaha.com.au
 
well, I don't know your whole setup, but if you are passing any number of variables to that one msgbox script, that may cause the problem when doing it from asp, vs. from the html code within the page.

Also, maybe you simply forgot the <script> anchors...I don't know. I'm not sure what your problem was caused by, but as long as the code I gave you works, then that is good. I would just try playing with the two scripts (your original, and the one I gave you) and check out the differences. You may see it yourself.

Glad to be of service.
-Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top