Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

[Microsoft][ODBC Microsoft Access Driver] Syntax Error in ORDER BY clause

Discussion in 'Information Technology' started by Marc Everlove, Nov 11, 2005.

  1. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    Here is the statement...

    SELECT *, rand() as random_number
    FROM image_img
    ORDER BY random_number DESC LIMIT 1

    I suspect that the rand() is not supported in MS Access. I am not sure what
    syntex to put in it's place...

    Can anybody tell me what I have done wrong?
     
  2. Loading...

    Similar Threads Forum Date
    Microsoft Warning Over Browser Security Flaw Information Technology Feb 1, 2011
    World Microsoft Apologizes for Changing Race in Photo Breaking News Aug 26, 2009
    DOWNLOAD BANI FILES - Microsoft Word Format Discourses in English Feb 11, 2008
    Microsoft Throws Prime-Time Party for Next Xbox (washingtonpost.com) Interfaith Dialogues May 14, 2005
    Microsoft Unveils New Windows Mobile (AP) Interfaith Dialogues May 11, 2005

  3. Jeff Boyce

    Jeff Boyce
    Expand Collapse
    Guest

    Marc

    If I were testing this SQL, I would first drop the ORDER BY clause and see
    what Access returns for the rest.

    What is the purpose of the "LIMIT 1" clause?

    Jeff Boyce
    <Office/Access MVP>

    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:%23oz7mkl5FHA.2364@TK2MSFTNGP12.phx.gbl...
    > Here is the statement...
    >
    > SELECT *, rand() as random_number
    > FROM image_img
    > ORDER BY random_number DESC LIMIT 1
    >
    > I suspect that the rand() is not supported in MS Access. I am not sure
    > what syntex to put in it's place...
    >
    > Can anybody tell me what I have done wrong?
    >
    >
     
  4. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    Wow that was quick!

    Ok, I am a network guy, so bear with me.

    I will try to drop that statement, and see what happens. I am using an
    extension for Dreamweaver... I got the statement from a tutorial. I am
    assuming that it is for a MySQL DB as they refer to a php file...

    Regarding the limit 1 clause, I have no idea. I am just struggling through
    this.

    I am ultimately attempting to create an image gallery that allows users to
    upload and display images...

    Thanks in advance!


    "Jeff Boyce" <nonsense@nonsense.com> wrote in message
    news:%23%230FSsl5FHA.2888@tk2msftngp13.phx.gbl...
    > Marc
    >
    > If I were testing this SQL, I would first drop the ORDER BY clause and see
    > what Access returns for the rest.
    >
    > What is the purpose of the "LIMIT 1" clause?
    >
    > Jeff Boyce
    > <Office/Access MVP>
    >
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:%23oz7mkl5FHA.2364@TK2MSFTNGP12.phx.gbl...
    >> Here is the statement...
    >>
    >> SELECT *, rand() as random_number
    >> FROM image_img
    >> ORDER BY random_number DESC LIMIT 1
    >>
    >> I suspect that the rand() is not supported in MS Access. I am not sure
    >> what syntex to put in it's place...
    >>
    >> Can anybody tell me what I have done wrong?
    >>
    >>

    >
    >
     
  5. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    ok I tried

    SELECT *, rand() as random_number
    FROM image_img

    and I got:

    Undefined function 'rand' in expression

    Looks like another looooong night...

    Thanks!!!

    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:OFRhXyl5FHA.1276@TK2MSFTNGP09.phx.gbl...
    > Wow that was quick!
    >
    > Ok, I am a network guy, so bear with me.
    >
    > I will try to drop that statement, and see what happens. I am using an
    > extension for Dreamweaver... I got the statement from a tutorial. I am
    > assuming that it is for a MySQL DB as they refer to a php file...
    >
    > Regarding the limit 1 clause, I have no idea. I am just struggling through
    > this.
    >
    > I am ultimately attempting to create an image gallery that allows users to
    > upload and display images...
    >
    > Thanks in advance!
    >
    >
    > "Jeff Boyce" <nonsense@nonsense.com> wrote in message
    > news:%23%230FSsl5FHA.2888@tk2msftngp13.phx.gbl...
    >> Marc
    >>
    >> If I were testing this SQL, I would first drop the ORDER BY clause and
    >> see what Access returns for the rest.
    >>
    >> What is the purpose of the "LIMIT 1" clause?
    >>
    >> Jeff Boyce
    >> <Office/Access MVP>
    >>
    >> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >> news:%23oz7mkl5FHA.2364@TK2MSFTNGP12.phx.gbl...
    >>> Here is the statement...
    >>>
    >>> SELECT *, rand() as random_number
    >>> FROM image_img
    >>> ORDER BY random_number DESC LIMIT 1
    >>>
    >>> I suspect that the rand() is not supported in MS Access. I am not sure
    >>> what syntex to put in it's place...
    >>>
    >>> Can anybody tell me what I have done wrong?
    >>>
    >>>

    >>
    >>

    >
    >
     
  6. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    The random number function in VBA is Rnd().

    If Rnd() is used in an SQL String in Access, it should be OK. However, you
    are only using JET (NOT Access) and Rnd() may NOT work for you.

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:#w3ye6l5FHA.2776@TK2MSFTNGP15.phx.gbl...
    > ok I tried
    >
    > SELECT *, rand() as random_number
    > FROM image_img
    >
    > and I got:
    >
    > Undefined function 'rand' in expression
    >
    > Looks like another looooong night...
    >
    > Thanks!!!
    >
     
  7. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    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???

    Thanks in advance!



    "Van T. Dinh" <VanThien.Dinh@discussions.microsoft.com> wrote in message
    news:%23u5Cbto5FHA.744@TK2MSFTNGP10.phx.gbl...
    > The random number function in VBA is Rnd().
    >
    > If Rnd() is used in an SQL String in Access, it should be OK. However,
    > you
    > are only using JET (NOT Access) and Rnd() may NOT work for you.
    >
    > --
    > HTH
    > Van T. Dinh
    > MVP (Access)
    >
    >
    >
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:#w3ye6l5FHA.2776@TK2MSFTNGP15.phx.gbl...
    >> ok I tried
    >>
    >> SELECT *, rand() as random_number
    >> FROM image_img
    >>
    >> and I got:
    >>
    >> Undefined function 'rand' in expression
    >>
    >> Looks like another looooong night...
    >>
    >> Thanks!!!
    >>

    >
    >
    >
     
  8. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    > 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)
     
  9. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    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!



    "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message news:eTDXXKx5FHA.3592@TK2MSFTNGP12.phx.gbl...
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    >> 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)
    >
    >
     
  10. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)



    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:eJ1$eN85FHA.1028@TK2MSFTNGP11.phx.gbl...
    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!



    "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
    news:eTDXXKx5FHA.3592@TK2MSFTNGP12.phx.gbl...
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    >> 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)
    >
    >
     
  11. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    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" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
    news:ush1cb85FHA.4012@TK2MSFTNGP14.phx.gbl...
    > 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
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    >
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:eJ1$eN85FHA.1028@TK2MSFTNGP11.phx.gbl...
    > 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!
    >
    >
    >
    > "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
    > news:eTDXXKx5FHA.3592@TK2MSFTNGP12.phx.gbl...
    >> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >> news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    >>> 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)
    >>
    >>

    >
     
  12. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    As I implied, if you're not calling from within Access, I don't believe
    there's any way you can return random rows.

    You might be able to have a list of possible images in memory, and choose
    one at random from that and explicitly select that image back. Or if you
    number your images, you could choose a random number and explicitly select
    the image with that number.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)



    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:eBBkpv85FHA.2560@TK2MSFTNGP12.phx.gbl...
    >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" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
    > news:ush1cb85FHA.4012@TK2MSFTNGP14.phx.gbl...
    >> 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
    >> http://I.Am/DougSteele
    >> (no e-mails, please!)
    >>
    >>
    >>
    >> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >> news:eJ1$eN85FHA.1028@TK2MSFTNGP11.phx.gbl...
    >> 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!
    >>
    >>
    >>
    >> "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
    >> news:eTDXXKx5FHA.3592@TK2MSFTNGP12.phx.gbl...
    >>> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >>> news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    >>>> 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)
    >>>
    >>>

    >>

    >
    >
     
  13. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in
    message news:uF%23BD085FHA.1864@TK2MSFTNGP12.phx.gbl
    [...]
    > Or if you number your images, you could choose a random number and
    > explicitly select the image with that number.


    That's what I was going to suggest.

    --
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com

    (please reply to the newsgroup)
     
  14. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:eBBkpv85FHA.2560@TK2MSFTNGP12.phx.gbl
    > I am attempting to call it from a webpage...


    Sorry, I didn't realize that you were executing your query from outside
    Access. Under those circumstances, you won't be able to use VBA
    functions, so that approach to picking random records won't work. I'd
    go with Doug Steele's idea of generatig a random number in code, and the
    selecting the record that has that number assigned to it.

    --
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com

    (please reply to the newsgroup)
     
  15. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    I was thinking as much...

    The unique key is an autonumbered field so I was thinking I could use that,
    BUT if I delete records the count won't be contiguous.

    *Sigh*

    I have SQL but I only have 10 licenses so I can't use it on a production
    website. $4,000 for a processor licence is a bit steep for this project.
    According to my predictions it would take 7,736 years to show a ROI based on
    my current Adsense earnings...

    This makes a good argument for going with MySQL, but I feel like that's
    almost like colaberating with the enemy... ;) Frankly I am trying to learn
    to program and I woule like to learn ONE language and get proficient, before
    I go on to others. ASP.Net is where I think the future lays, but it seems
    all the tutorials I come across are for php...

    My only alternative that I can see at this point is to use a 3rd party
    Windows based web host and run MS SQL and go that route. I am just about
    ready to take a flying leap from my desk...

    *thud*

    Thanks for all of your help...

    Best Regards,
    Marc Everlove

    "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
    news:uF%23BD085FHA.1864@TK2MSFTNGP12.phx.gbl...
    > As I implied, if you're not calling from within Access, I don't believe
    > there's any way you can return random rows.
    >
    > You might be able to have a list of possible images in memory, and choose
    > one at random from that and explicitly select that image back. Or if you
    > number your images, you could choose a random number and explicitly select
    > the image with that number.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    >
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:eBBkpv85FHA.2560@TK2MSFTNGP12.phx.gbl...
    >>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" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
    >> news:ush1cb85FHA.4012@TK2MSFTNGP14.phx.gbl...
    >>> 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
    >>> http://I.Am/DougSteele
    >>> (no e-mails, please!)
    >>>
    >>>
    >>>
    >>> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >>> news:eJ1$eN85FHA.1028@TK2MSFTNGP11.phx.gbl...
    >>> 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!
    >>>
    >>>
    >>>
    >>> "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
    >>> news:eTDXXKx5FHA.3592@TK2MSFTNGP12.phx.gbl...
    >>>> "Marc Everlove" <techknow@atkweb.com> wrote in message
    >>>> news:uSvvTDx5FHA.2196@TK2MSFTNGP10.phx.gbl
    >>>>> 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)
    >>>>
    >>>>
    >>>

    >>
    >>

    >
    >
     
  16. Dirk Goldgar

    Dirk Goldgar
    Expand Collapse
    Guest

    "Marc Everlove" <techknow@atkweb.com> wrote in message
    news:eee7NsJ6FHA.3616@TK2MSFTNGP10.phx.gbl
    > I was thinking as much...
    >
    > The unique key is an autonumbered field so I was thinking I could use
    > that, BUT if I delete records the count won't be contiguous.
    >
    > *Sigh*
    >
    > I have SQL but I only have 10 licenses so I can't use it on a
    > production website. $4,000 for a processor licence is a bit steep for
    > this project. According to my predictions it would take 7,736 years
    > to show a ROI based on my current Adsense earnings...
    >
    > This makes a good argument for going with MySQL, but I feel like
    > that's almost like colaberating with the enemy... ;) Frankly I am
    > trying to learn to program and I woule like to learn ONE language and
    > get proficient, before I go on to others. ASP.Net is where I think
    > the future lays, but it seems all the tutorials I come across are for
    > php...
    >
    > My only alternative that I can see at this point is to use a 3rd party
    > Windows based web host and run MS SQL and go that route.


    What are the characteristics of this website? What kind of traffic do
    you expect? Is it possible you could use MSDE for the database?

    --
    Dirk Goldgar, MS Access MVP
    www.datagnostics.com

    (please reply to the newsgroup)
     
  17. Marc Everlove

    Marc Everlove
    Expand Collapse
    Guest

    Hmmm, Now that is something I hadn't considered...

    MSDE goes by concurrent connections correct? I imagine that might just work.

    I already have MS SQL installed on the server. It doesn't really matter
    though because I am not using it for anything. I had a chat with a fellow
    from MS Licencing and he gave me the lowdown on running SQL. From what I
    understand with SQL it's per seat licensing, so it is impossible to run
    anything other than a Processor licence...

    I hadn't even considered MSDE. I think I will need to uninstall SQL, but
    Cest 'la Vie.

    The url is http://victorsfunnies.com although I have the scripts I have been
    discussing elsewhere. Currently Vic's Funnies is hand coded for each
    image... You can see where it gets tedious...

    Thanks! Hope you get a chuckle out of the site...


    "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
    news:Oq0JhOK6FHA.1000@tk2msftngp13.phx.gbl...
    > "Marc Everlove" <techknow@atkweb.com> wrote in message
    > news:eee7NsJ6FHA.3616@TK2MSFTNGP10.phx.gbl
    >> I was thinking as much...
    >>
    >> The unique key is an autonumbered field so I was thinking I could use
    >> that, BUT if I delete records the count won't be contiguous.
    >>
    >> *Sigh*
    >>
    >> I have SQL but I only have 10 licenses so I can't use it on a
    >> production website. $4,000 for a processor licence is a bit steep for
    >> this project. According to my predictions it would take 7,736 years
    >> to show a ROI based on my current Adsense earnings...
    >>
    >> This makes a good argument for going with MySQL, but I feel like
    >> that's almost like colaberating with the enemy... ;) Frankly I am
    >> trying to learn to program and I woule like to learn ONE language and
    >> get proficient, before I go on to others. ASP.Net is where I think
    >> the future lays, but it seems all the tutorials I come across are for
    >> php...
    >>
    >> My only alternative that I can see at this point is to use a 3rd party
    >> Windows based web host and run MS SQL and go that route.

    >
    > What are the characteristics of this website? What kind of traffic do
    > you expect? Is it possible you could use MSDE for the database?
    >
    > --
    > Dirk Goldgar, MS Access MVP
    > www.datagnostics.com
    >
    > (please reply to the newsgroup)
    >
    >
     

Share This Page