Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Vail, Colorado, USA
    Posts
    194
    Thanks
    36
    Thanked 0 Times in 0 Posts

    DAO & Crosstab Queries (2000)

    I am trying to create a report from a crosstab query and I run into a problem using DAO. My understanding is that I cannot use ADO with crosstab queries.

    The variables I have defined are

    Option Compare Database
    'Constant for Column count of Weeks 13 weeks plus 1 for total
    Const conTotalColumns = 13
    'Variables for Database Object and Recordset
    Dim mrstReport As DAO.Recordset

    'Variables for number of coumns and rows
    Dim mintColumnCount As Integer
    Dim mlngRgColumnTotal(1 To conTotalColumns) As Long
    Dim mlngReportTotal As Long

    It is the DAO.Recordset that gives me a problem. In testing the report when I try and open it I get the following message.

    The expression On Open you entered as the event property setting produced the following error : User Defined type not defined

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: DAO & Crosstab Queries (2000)

    If you want to use DAO, you must set a reference to the DAO object library:
    - Activate the Visual Basic Editor.
    - Select Tools | References...
    - Locate and tick Microsoft DAO 3.6 Object Library.
    - Click OK.

    By the way, it is possible to create an ADO recordset from a crosstab query too.

  3. #3
    2 Star Lounger
    Join Date
    Apr 2003
    Location
    Vail, Colorado, USA
    Posts
    194
    Thanks
    36
    Thanked 0 Times in 0 Posts

    Re: DAO & Crosstab Queries (2000)

    Thanks Hans I knew it would be something simple, that fixed the problem. The book I am working from " Access 2000 Development" said you could not use a Crosstab with ADO so I will try that anyway. Once again my thanks.

    Peter

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: DAO & Crosstab Queries (2000)

    If you use ADO to create a query, you have to pass the parameters in differently, using something more like the SQL Server syntax than what you're used to with DAO.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •