I am attempting to call it from a webpage...
In a nutshell, I am attempting to retreive random images from paths
stored in the database. Basically a photogallery. In a nutshell I would
like to make
http://victorsfunnies.com dynamic so I don't have to
hand-code everything in there. I have the file upload process squared
away, but I woule like to display a randome image so the user could click
a link that posts back to the same url just showing a different image...
I am using Dreamweaver 8 and the Interakt extension (which is supposed to
support asp but unsurprisingly doesn't work)
Victorsfunnies.com is basically a proving ground for a far more serious
project I have been working on. I would like to upload and return real
estate listings...
I am going crazy...
I really appreciate your assistance, I value your time. I will post my
code...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/connGallery.asp" -->
<!--#include file="../includes/tNG/tNG.inc.asp" -->
<%
Dim rsImages
Dim rsImages_numRows
Set rsImages = Server.CreateObject("ADODB.Recordset")
rsImages.ActiveConnection = MM_connGallery_STRING
rsImages.Source = "select top 1 image_img.*from image_img where
randomizer() = 0 order by rnd(isnull(image_img.id_img) * 0 + 1)"
rsImages.CursorType = 0
rsImages.CursorLocation = 2
rsImages.LockType = 1
rsImages.Open()
rsImages_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<img src="<%=tNG_showDynamicThumbnail("../", "../Uploads/",
"{rsImages.filename_img}", 50, 50, true)%>" />
</body>
</html>
<%
rsImages.Close()
Set rsImages = Nothing
%>
Douglas J. Steele said:
How are calling your query? Is it from outside of Access (VB, VB.Net,
ASP, etc.)? If so, I'm afraid you're out of luck: you can only use VBA
user-defined functions from inside Access.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Ok, I did my best to follow the directions but now it returns the error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Undefined function
'randomizer' in expression.
/uptest/ugh02.asp, line 14
Of course line 14 is where I open the recordset...
I added the module to the database, but frankly, I am a noob at this so
I am not certain I did it correctly. I have been attempting to look up
information on how to accomplish this all, but have not been very
successful. However, the randomizer query you linked to has come up a
few times, so it is probably the best option. Now if I could just figure
out how to make it work...
I really appreciate all the assistance!
Ok I rewrote the statement so it is now:
SELECT *
FROM image_img
ORDER BY rnd(1(id_img) * 0 + 1)
It doesn't return an error but the image is always the same... It
doesn't randomize!
What's amiss with it???
See this link:
http://www.mvps.org/access/queries/qry0011.htm
Queries: Create a query that returns Random records
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)