473,378 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Compile Error in VBA

I have a database that was designed in Access 2002 and has been working perfectly. I was switched to a new pc that has Access 2003 and now I'm getting an error message: "Compile Error: Method or data member not found."

Expand|Select|Wrap|Line Numbers
  1. Dim rs As Recordset
  2. Dim rst As Recordset
  3. Dim sql As String
  4. Dim str As String
  5. Dim strqry As String
  6. Dim icount As Integer
  7.  
  8. str = "SELECT [CRISSRef], [Comments1], [Date], [Time]" & _
  9.     "FROM tblComments ORDER BY [CRISSRef], [Date], [Time]"
  10. Set rst = CurrentDb.OpenRecordset(str)
  11.  
  12. While Not rst.EOF
  13. sql = "Select * from [tcomments] where  [crissref]=" & rst(0) & " order by [crissref]"
  14.  
  15. Set rs = CurrentDb.OpenRecordset(sql)
  16.  
  17. rs.Edit            <----------------------Code fails here and .Edit is highlighted
  18. If IsNull(rs(1)) Then
  19. rs(1) = Left(rst(1), 255)
there's more code but I think this may give the gist of it....

I have references to MS Access 11.0 Object Library, MS ActiveX Data Objects Library 2.8. Is it the new version of Access or am I missing a reference?

Thanks for your help!
Mar 14 '08 #1
2 1987
Stewart Ross
2,545 Expert Mod 2GB
Hi. You are indeed missing a reference, to the Microsoft DAO object library. You will also need to qualify your recordset declarations to refer to the DAO (Data Access Objects) version explicitly. The problem arises because recordset objects are available in different types - ADOX, DAO, whatever. These have differing method statements and properties... a darn nuisance when moving from one version of Access to another.

Anyway, if you add the latest Microsoft DAO x.x Object Library to your references and change the DIM to
Expand|Select|Wrap|Line Numbers
  1. Dim rst As DAO.Recordset
all should work again.

-Stewart
Mar 14 '08 #2
That worked!! Thank you so much!!!!!
Mar 14 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Danny Boelens | last post by:
Hi all, today I ran into a compile error after a compiler upgrade. I made a small example to demonstrate my compile error: template<typename T1, typename T2> class A {}; class B
5
by: Carmine Cairo | last post by:
Hi, I'm working on a project and today I've note a little problem during the compile fase. Here a little piece of code: // 1st version welldone = 0; size = p->getSize(); backbone = new...
5
by: Brice Prunier | last post by:
Here under 4 schemas i'm working with ( it may be long: sorry...) The context is the following : Resident.xsd imports Person.xsd and includes Common.xsd ( anonimous schema: no TargetNamespace )...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
0
by: Jim Heavey | last post by:
Internal Compiler Error: stage 'BEGIN' Hello, I had an application which was working just fine and I decided to modify all database access within the application to utilizie a new Namespace that I...
9
by: ThunderMusic | last post by:
Hi, I'd like to create a compile time error in my class... maybe there's a way already built in in the framework so I can achieve what I want... I have 2 constructors in my class. One of them...
4
by: tony | last post by:
Hello! My question is about calling this method CollectData below but I get a compile error that I shouldn't have because the type parameter is correct. The compile error is the following:...
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.