Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 1st, 2004, 07:51 PM
Authorized User
 
Join Date: Nov 2004
Location: North Ryde, NSW, Australia.
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

Reply With Quote
  #2 (permalink)  
Old December 1st, 2004, 10:27 PM
Authorized User
 
Join Date: Jul 2004
Location: Sydney, NSW, Australia.
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
Reply With Quote
  #3 (permalink)  
Old December 1st, 2004, 10:58 PM
Authorized User
 
Join Date: Nov 2004
Location: North Ryde, NSW, Australia.
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



Reply With Quote
Reply


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



All times are GMT -4. The time now is 06:58 PM.


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