If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Conversion from 2007 to 2010 - module VBA Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-10-12, 10:11
Krista327 Krista327 is offline
Registered User
 
Join Date: May 2005
Posts: 114
Red face 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?
Reply With Quote
  #2 (permalink)  
Old 08-10-12, 10:22
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 4,194
Try:
Code:
Set mdb As DAO.Database
and check that you have the necessary reference in your project.
__________________
Have a nice day!
Reply With Quote
  #3 (permalink)  
Old 08-10-12, 10:25
Krista327 Krista327 is offline
Registered User
 
Join Date: May 2005
Posts: 114
Thank you for the quick response, it worked great!
Reply With Quote
  #4 (permalink)  
Old 08-10-12, 10:31
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 4,194
You're welcome!
__________________
Have a nice day!
Reply With Quote
  #5 (permalink)  
Old 08-10-12, 10:48
Krista327 Krista327 is offline
Registered User
 
Join Date: May 2005
Posts: 114
How about Rs.recordcount? Doesn't work either... (rs being a recordset of course, but you already knew that).
Reply With Quote
  #6 (permalink)  
Old 08-10-12, 11:00
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 4,194
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!
Reply With Quote
  #7 (permalink)  
Old 08-10-12, 11:00
Krista327 Krista327 is offline
Registered User
 
Join Date: May 2005
Posts: 114
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
Reply With Quote
  #8 (permalink)  
Old 08-10-12, 11:02
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 4,194
Try:
Code:
dim mdb As dao.Database, rs As DAO.Recordset
__________________
Have a nice day!
Reply With Quote
  #9 (permalink)  
Old 08-10-12, 11:12
Krista327 Krista327 is offline
Registered User
 
Join Date: May 2005
Posts: 114
thanks again!! Everything seems to be working now.
Reply With Quote
  #10 (permalink)  
Old 08-10-12, 15:47
Sinndho Sinndho is offline
Registered User
 
Join Date: Mar 2009
Posts: 4,194
You're welcome!
__________________
Have a nice day!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On