Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning Access VBA
This is the forum to discuss the Wrox book Beginning Access 2002 VBA by Robert Smith, Dave Sussman, Ian Blackburn, John Colby, Mark Horner, Martin Reid, Paul Turley, Helmut Watson; ISBN: 9780764544026
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access VBA 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
  #1 (permalink)  
Old July 13th, 2004, 02:10 PM
Registered User
 
Join Date: Jul 2004
Location: Suisun City, CA, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8: Results Table not building

I'm trying to run the Matching Records code in Chapter 8, page 271 - 272.

When I click on the Criteria form's Find Matches button, I get the error string "There was a problem building the SQL string".

The book says (page 272, step 6): "Now open the criteria form frmCriteria in form view and hit the Find Matches button without entering any criteria."

This is supposed to bring up the frmSales form, which isn't happening (see above error). In addition, this should be creating the table tblResults, which isn't happening either.

So, I'm apparently dying at the

If Not EntriesValid Then Exit Sub

If Not BuildSQLString(strSQL) Then
    MsgBox "There was a problem building the SQL string"
    Exit Sub
End If


chunk of code and never making it to the BuildResultsTable function.

What am I missing?

Note: I've also tried entering criteria in the form, but I die at the same place in the code.

Thanks in advance,

--Steve

  #2 (permalink)  
Old September 7th, 2004, 06:11 AM
Registered User
 
Join Date: Sep 2004
Location: glasgow, , United Kingdom.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Steve,

I have had the same problem and realised that they have forgotten to mention that the following codes needs to be added for the EntriesValid.
When checking into the later chapter, I founf it:
Just add it into the frmCriteria as a new function:

Function DisplayResults(lRecords As Long) As Boolean

Dim iReturn As Integer
Dim sMsg As String

Select Case lRecords
    Case 0
        sMsg = "No records matched the criteria you specified."
        MsgBox sMsg, vbExclamation, Application.Name
        DisplayResults = True
        Exit Function
    Case 1
        sMsg = "1 record matched the criteria you specified."
        sMsg = sMsg & vbCrLf & vbCrLf & "Would you like to see it?"
    Case Is > 1
        sMsg = lRecords & " records matched the criteria you specified."
        sMsg = sMsg & vbCrLf & vbCrLf & "Would you like to see them?"
End Select

iReturn = MsgBox(sMsg, _
            vbQuestion + vbYesNo + vbDefaultButton1, _
            Application.Name)

If iReturn = vbYes Then
    DoCmd.OpenForm "frmSales"
    DoCmd.Close acForm, Me.Name
End If

DisplayResults = True

End Function

Good luck,
Chris


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4 building error LanceWang BOOK: Professional Java Development with the Spring Framework 0 March 7th, 2008 06:53 PM
Chapter 10 - building objects kscase BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 5 April 23rd, 2007 04:55 AM
building crystal report table programmatically khaled_mm VB Components 1 October 6th, 2006 02:26 AM
Building table rows dynamically nikotromus General .NET 2 January 21st, 2006 11:10 PM





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