Results 1 to 10 of 10
  1. #1
    Join Date
    May 2005
    Posts
    119

    Red face Unanswered: Conversion from 2007 to 2010 - module VBA Error

    I just converted an app from 2007 to 2010 and the module line "set mdb as database" doesn't work. I receive the message, "Compile error: Expected user-defined type, not project". What's the new code for 2010?

    It is unfortunate that I just haven't taken the time to learn 2010, but no time like the present, huh?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    Set mdb As DAO.Database
    and check that you have the necessary reference in your project.
    Have a nice day!

  3. #3
    Join Date
    May 2005
    Posts
    119
    Thank you for the quick response, it worked great!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

  5. #5
    Join Date
    May 2005
    Posts
    119
    How about Rs.recordcount? Doesn't work either... (rs being a recordset of course, but you already knew that).

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    When you say "does not work", do you mean that you receive an error (if yes please specify the error number and message) or do you mean that it does not return what you expect ?
    Have a nice day!

  7. #7
    Join Date
    May 2005
    Posts
    119
    Compile error:
    Method or data member not found

    dim mdb As dao.Database, rs As Recordset
    Set rs = mdb.OpenRecordset("cwa_pendingreports")
    If rs.RecordCount > 0 Then
    DoCmd.OpenForm "cwa_pendingreports"
    End If

  8. #8
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    dim mdb As dao.Database, rs As DAO.Recordset
    Have a nice day!

  9. #9
    Join Date
    May 2005
    Posts
    119
    thanks again!! Everything seems to be working now.

  10. #10
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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