Wrox Programmer Forums
|
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2004, 07:51 PM
Authorized User
 
Join Date: Nov 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter14 - P421

I can not get my program to use:
ReplaceOrderByClause and ReplaceWhereClause

The Following Error Message Appears: "Compile Error: Sub or function not Defined"

I have checked all the references but there is no missing or broken on in my list

Please any anybody can help

Thank you

 
Old December 1st, 2004, 10:27 PM
Authorized User
 
Join Date: Jul 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Zaff,

I didn't write that chapter, but it seems ReplaceOrderByClause() isn't provided in the text. Here's something I knocked up to get you out of trouble:

Public Function ReplaceOrderByClause(strSQL As String, strNewOrderByClause As String) As String
    'Replace the OrderBy clause in an SQL string
    Dim strSQLTmp As String
    Dim intPos As Integer

    intPos = InStrRev(UCase(strSQL), "ORDER BY", -1)

    ReplaceOrderByClause = Left(strSQL, intPos + 8) & strNewOrderByClause
End Function

The above function does not take account of order direction (for example, ASC or DESC).

Graham R Seach
Microsoft Access MVP
 
Old December 1st, 2004, 10:58 PM
Authorized User
 
Join Date: Nov 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Graham for your Quick response

What I have done I used simpler method than it is mentioned in the book, to get the form.recordsource updated.

I constructed the SQL Statement to select the fields from the tables, and " Order BY <fieldname>" is added to the Statement based on the user selection, so when he choose to sort by <name> VBA will add " Order By tblP_Card.name" to Select Statement, in away I found it much easier than using ReplaceOrderByClause.

Also when I downloaded the sample it run with no problem, but when I put it in my system it did not

Thanks again








Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter14, checkout2.php-Msql error JECovill BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 30th, 2006 05:10 PM





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