Wrox Programmer Forums
|
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 3rd, 2008, 02:01 PM
Registered User
 
Join Date: Oct 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to pjremy
Default Binding Report in VBA

Hello all. I am building an application that uses a MYSQL backend. I am unable to bind a report to an ADO recordset. Attempting to bind the reports record source property results in an "invalid use of property" error. Any help would be greatly appreciated.

Thanks a million
 
Old October 6th, 2008, 10:33 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

How are you doing the binding? I find something like this will generally work? Can you post the code?

Private Sub Form_Open(Cancel As Integer)

  Dim conn As ADODB.Connection
  Dim rs As ADODB.Recordset

  Set conn = CurrentProject.AccessConnection
  Set rs = New ADODB.Recordset
  With rs
    Set .ActiveConnection = conn
    .Source = "SELECT * FROM tblCompany"
    .LockType = adLockOptimistic
    .CursorType = adOpenKeyset
    .CursorLocation = adUseServer
    .Open
  End With
  'Set the form's Recordset property to the ADO recordset
  Set Me.Recordset = rs
  Set rs = Nothing
  Set conn = Nothing
End Sub



mmcdonal

Look it up at: http://wrox.books24x7.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal report binding with large data set, error lankark Crystal Reports 0 April 3rd, 2008 09:16 AM
Dynamic Binding in Report Viewer ritesh2381 ASP.NET 2.0 Professional 0 November 19th, 2007 07:29 AM
Binding a DataSet to Cystal Report snufse Crystal Reports 0 March 30th, 2007 07:06 AM
How to generate a report using vba ? method Access VBA 1 May 3rd, 2005 04:48 AM
Binding a Dataset to a Report ChrisLane Crystal Reports 4 March 9th, 2004 02:04 AM





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