Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the 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
 
Old October 8th, 2003, 11:38 AM
Authorized User
 
Join Date: Sep 2003
Location: Ipswich UK, , United Kingdom.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MattLeek
Default Recordsets - Opening

I am using the bookBeginning Access 2002 VBA and am stuck on Chapter 6 (page 226 for those who have it) which is opening a recordset. I have typed in the code it tells you to enter and this is a copy of what i have entered:

Public Sub OpeningARecordset()

    Dim db As Database
    Dim rec As Recordset
    Dim intRecords As Integer
    Dim message

    Set db = CurrentDb()
    Set rec = db.OpenRecordset("tblIceCream")

    intRecords = rec.RecordCount
    MsgBox "There are " & intRecords & " records in the tblIceCream table"
    rec.Close

End Sub

(just incase i spelt something wrong)

But it comes up with a Compile Error Expected: =.

It says in the book that you have to make sure your references are correct and they are all in order ( I have: "Visual Basic For Applications", "Microsoft Access 10.0 Object Library", "OLE Automation" and "Microsoft DAO 3.6 Object Library" all check and nothing else. I cant work out what i've done wrong.

Can anyone help?

Matthew Leek
__________________
Thanks,
Matthew
 
Old October 8th, 2003, 04:59 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Everything there looks ok. Does it give you a line number for the error?

Peter
 
Old October 9th, 2003, 09:46 AM
Authorized User
 
Join Date: Sep 2003
Location: Ipswich UK, , United Kingdom.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MattLeek
Default

No thats all it says

Matthew Leek
 
Old October 9th, 2003, 03:21 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This probably won't help, but

Expected =

usually appears when you're using a function that can be used in two ways. When these functions contain parentheses, VBA expects an quals sign. But I don't see that problem in your code. Did you copy and paste it from the code you're using?

 
Old October 9th, 2003, 04:10 PM
Authorized User
 
Join Date: Sep 2003
Location: Ipswich UK, , United Kingdom.
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to MattLeek
Default

Yeah its copied strait out of the VBA window.

Matthew Leek
 
Old October 12th, 2003, 11:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Norwich, Norfolk, United Kingdom.
Posts: 129
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I copied and pasted your code into a newly-created Access97 database and it works ok.

Clive Astley




Similar Threads
Thread Thread Starter Forum Replies Last Post
Recordsets JezLisle Access VBA 11 July 17th, 2007 03:47 AM
Help with Recordsets voskoue Access VBA 1 January 23rd, 2007 08:36 AM
Need help with recordsets chacquard Access VBA 5 June 21st, 2004 11:58 PM
Recordsets bph Access VBA 17 February 17th, 2004 03:19 PM
XML recordsets Raul XML 4 February 12th, 2004 03:57 PM





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