Error: Expected user-defined type, not project (1 Viewer)

freightguy

Registered User.
Local time
Today, 00:37
Joined
Mar 1, 2016
Messages
36
Hello All
I’ve been dabbling with MS Access since the 97 version and created several applications in 97, 2000 and 2002 version and then converted them to 2013 … without too many issues.

Back in March there was a huge MS Office update and since that date I’ve had issues with MS Access 2013. I also have a virtual office to be able to run MS Access 97 and that one is NOT affected in any way.

I’ve been scouring the internet for answers but not much luck. I’m hoping someone can show me the way to resolving this issue.
Problem: when I click on a command that makes reference to a recordset, it errors as follows: “ Expected user-defined type, not project.” I did not change anything and whenever I do, I am careful to create an experimental version before making any changes. I checked other postings on this site and couldn’t find anything similar to my problem.

Code:
Private Sub Command29_Click()
Dim SQLStmt
SQLStmt = "SELECT ID, Quote, Currency, Rate, RateType, Qty, HidWgt,Weight,WgtBrk FROM [Carrier Rates - Detail] WHERE QUOTE = '" & Me!
& "' ORDER BY RATE desc"
Dim rs As Recordset
Dim i As Integer
Dim dbs As Database ‘ THIS IS WHERE IT ERRORS
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset(SQLStmt)
Dim WgtBrk As Double
… and much more
Any help or direction would be appreciated.
Thank you
Ray
 

freightguy

Registered User.
Local time
Today, 00:37
Joined
Mar 1, 2016
Messages
36
I neglected to mention my references show the following:
Visual Basic for Applications
Microsoft Access 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Access database engine Object Library

thx again
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:37
Joined
May 7, 2009
Messages
19,241
try referencing it using DAO:

dim dbs As DAO.Database

since you don't have reference to ADODB.
 

JHB

Have been here a while
Local time
Today, 09:37
Joined
Jun 17, 2012
Messages
7,732
Try if you get errors in the attached database.
 

Attachments

  • Database32 - Kopi.accdb
    380 KB · Views: 237

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 08:37
Joined
Sep 12, 2006
Messages
15,653
I think it's to do with ADO/DAO

at various times, MS decided that DAO would be the default, and at others ADO.

I always use DAO and ensure the DAO object library is declared above ADO.
I have never had to explicitly declare DAO libraries when declaring variables.

in A2003, for instance my libraries are, in this order

VBA
Access 11.0 object library
Ole Automation
DAO 3.6
etc

not sure what the equivalent order and required libraries are in A2013
 

freightguy

Registered User.
Local time
Today, 00:37
Joined
Mar 1, 2016
Messages
36
[SOLVED] Re: Error: Expected user-defined type, not project

thank you all - not referencing DAO was my downfall.

Cheers and much appreciated!
 

Users who are viewing this thread

Top Bottom