Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 6th, 2003, 06:48 PM
Authorized User
Join Date: Jun 2003
Location: Dublin, , Ireland.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default NEWID() in Access Database

I am working on this project and I want to display a random recordset, but it does not seem towork with Access at all.

I have it workin in SQL 2000 database but access is more complicated.

Can anyone help?

Dim rsSpecials
Dim rsSpecials_numRows

Set rsSpecials = Server.CreateObject("ADODB.Recordset")
rsSpecials.ActiveConnection = MM_conn_STRING
rsSpecials.Source = "SELECT P_Name, P_OnSpecial, P_OnSpecialPrice, P_SmallPicture, P_ID, NEWID() AS P_ID1 FROM Products WHERE P_OnSpecial=yes ORDER BY P_ID1"
rsSpecials.CursorType = 0
rsSpecials.CursorLocation = 2
rsSpecials.LockType = 1

rsSpecials_numRows = 0

The NEWID() part is the problem.

I tried RAND() but.......

L Ion
L Ion
Reply With Quote
  #2 (permalink)  
Old November 10th, 2003, 06:21 PM
Authorized User
Join Date: Jun 2003
Location: Dublin, , Ireland.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts

I sorted out this way:

Const adCmdText = &H0001

Dim rsNewProducts
Dim rsNewProducts_numRows

Set rsNewProducts = Server.CreateObject("ADODB.Recordset")
rsNewProducts.ActiveConnection = MM_conn_STRING
rsNewProducts.Source = "SELECT * FROM NewProducts ORDER BY P_DATEADDED"
rsNewProducts.CursorType = 0
rsNewProducts.CursorLocation = 3
rsNewProducts.LockType = 1

rsNewProducts_numRows = 0

Dim intRnd
        Randomize Timer
        intRnd = (Int(RND * rsNewProducts.RecordCount))

        ' Now moving the cursor to random record number
    rsNewProducts.Move intRnd

L Ion
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to seed or increment NEWID() value suji SQL Server 2005 4 February 19th, 2008 02:45 PM
Database Connection to Access Database reachsevar ASP.NET 2.0 Basics 1 November 28th, 2007 08:56 AM
Remote access to an Access Project Database bright_mulenga Access 0 February 9th, 2006 10:51 AM
Access issues with ASP and a MS Access Database rj_conceptsnrec.com Classic ASP Databases 2 May 19th, 2005 12:44 PM
NEWID() Lucian Ion Access ASP 1 November 10th, 2003 06:21 PM

All times are GMT -4. The time now is 10:05 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.