473,714 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error: User-Defined Type Not Defined

In A97 on WinXP, I'm trying to use a KB function to provide the next
sequential number in a custom counter (a table with two fields--
[NextAvailable] and [FromYear] ). When I run it, I get the "User-defined
type not defined" error on the third line of code (Dim rs As
ADODB.Recordset ) I'm using below:

" Function Next_Custom_Cou nter()
On Error GoTo Next_Custom_Cou nter_Err

Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTab le", CurrentProject. Connection, adOpenKeyset,
adLockOptimisti c

NextCounter = rs!NextAvailabl eCounter
If rs!FromYear < Year(Date) Then
rs!FromYear = Year(Date)
NextCounter = 0
End If

rs!NextAvailabl eCounter = NextCounter + 1
NextCounter = rs!NextAvailabl eCounter
rs.Update

MsgBox "Next available counter value is " & Str(NextCounter )

rs.Close

Set rs = Nothing

Next_Custom_Cou nter = NextCounter

Exit Function
Next_Custom_Cou nter_Err:
MsgBox "Error " & Err & ": " & Error$
If Err <> 0 Then Resume
End
End Function "

I know this has been asked and answered "1000 times", but I did check my
references which are:

Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft ADO Ext. 2.7 for DLL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Object Recordset 2.7 Library

I read the 'Help' file and the 'Reference' issue seemed to be the only one
of the three that was applicable to this code. Is there another reason I'm
getting this error or am I missing something regarding my References?

Thx for any help.
Earl

Nov 12 '05 #1
6 12737
Try MDAC 2.5:
http://support.microsoft.com/default.aspx?kbid=293312
2.7 does not include the JET drivers IIRC.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Earl Anderson" <is*****@rcn.co m> wrote in message
news:40******** **************@ news.rcn.com...
In A97 on WinXP, I'm trying to use a KB function to provide the next
sequential number in a custom counter (a table with two fields--
[NextAvailable] and [FromYear] ). When I run it, I get the "User-defined
type not defined" error on the third line of code (Dim rs As
ADODB.Recordset ) I'm using below:

" Function Next_Custom_Cou nter()
On Error GoTo Next_Custom_Cou nter_Err

Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTab le", CurrentProject. Connection, adOpenKeyset,
adLockOptimisti c

NextCounter = rs!NextAvailabl eCounter
If rs!FromYear < Year(Date) Then
rs!FromYear = Year(Date)
NextCounter = 0
End If

rs!NextAvailabl eCounter = NextCounter + 1
NextCounter = rs!NextAvailabl eCounter
rs.Update

MsgBox "Next available counter value is " & Str(NextCounter )

rs.Close

Set rs = Nothing

Next_Custom_Cou nter = NextCounter

Exit Function
Next_Custom_Cou nter_Err:
MsgBox "Error " & Err & ": " & Error$
If Err <> 0 Then Resume
End
End Function "

I know this has been asked and answered "1000 times", but I did check my
references which are:

Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft ADO Ext. 2.7 for DLL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Object Recordset 2.7 Library

I read the 'Help' file and the 'Reference' issue seemed to be the only one
of the three that was applicable to this code. Is there another reason I'm getting this error or am I missing something regarding my References?

Thx for any help.
Earl

Nov 12 '05 #2
Went to 'References', checked "Microsoft Data Access Components Installed
Version", to include it with the other 5 checked references -- no luck; same
compile error. I went to the Microsoft site and tried to download it, but
installation was halted because it was "already installed". Could there be
a conflict between any of the 6 References? Short of starting over, is there
anything else I should be looking at/for in the References or code?

Thx...
Earl

"Allen Browne" <Al*********@Se eSig.Invalid> wrote in message
news:40******** **************@ freenews.iinet. net.au...
Try MDAC 2.5:
http://support.microsoft.com/default.aspx?kbid=293312
2.7 does not include the JET drivers IIRC.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Earl Anderson" <is*****@rcn.co m> wrote in message
news:40******** **************@ news.rcn.com...
In A97 on WinXP, I'm trying to use a KB function to provide the next
sequential number in a custom counter (a table with two fields--
[NextAvailable] and [FromYear] ). When I run it, I get the "User-defined type not defined" error on the third line of code (Dim rs As
ADODB.Recordset ) I'm using below:

" Function Next_Custom_Cou nter()
On Error GoTo Next_Custom_Cou nter_Err

Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTab le", CurrentProject. Connection, adOpenKeyset,
adLockOptimisti c

NextCounter = rs!NextAvailabl eCounter
If rs!FromYear < Year(Date) Then
rs!FromYear = Year(Date)
NextCounter = 0
End If

rs!NextAvailabl eCounter = NextCounter + 1
NextCounter = rs!NextAvailabl eCounter
rs.Update

MsgBox "Next available counter value is " & Str(NextCounter )

rs.Close

Set rs = Nothing

Next_Custom_Cou nter = NextCounter

Exit Function
Next_Custom_Cou nter_Err:
MsgBox "Error " & Err & ": " & Error$
If Err <> 0 Then Resume
End
End Function "

I know this has been asked and answered "1000 times", but I did check my
references which are:

Visual Basic for Applications
Microsoft Access 8.0 Object Library
Microsoft ADO Ext. 2.7 for DLL and Security
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Object Recordset 2.7 Library

I read the 'Help' file and the 'Reference' issue seemed to be the only one of the three that was applicable to this code. Is there another reason

I'm
getting this error or am I missing something regarding my References?

Thx for any help.
Earl


Nov 12 '05 #3
rkc

"Earl Anderson" <is*****@rcn.co m> wrote in message
news:40******** **************@ news.rcn.com...
Went to 'References', checked "Microsoft Data Access Components Installed
Version", to include it with the other 5 checked references -- no luck; same compile error. I went to the Microsoft site and tried to download it, but
installation was halted because it was "already installed". Could there be a conflict between any of the 6 References? Short of starting over, is there anything else I should be looking at/for in the References or code?


Try unchecking
"Microsoft ActiveX Data Object Recordset 2.7 Library"
and checking
"Microsoft ActiveX Data Object 2.7 Library"

Aren't you going to have problems when you get to the line

rs.Open "CounterTab le", CurrentProject. Connection, adOpenKeyset...

in an Access 97 application? CurrentProject?



Nov 12 '05 #4
That took care of the "User-defined type not defined" error and yes, I did
get the error on 'CurrentProject ' and declared that also.

Thanks to both you and Allen.
Earl

"rkc" <rk*@yabba.dabb a.do.rochester. rr.bomb> wrote in message
news:ZV******** ***********@twi ster.nyroc.rr.c om...

"Earl Anderson" <is*****@rcn.co m> wrote in message
news:40******** **************@ news.rcn.com...
Went to 'References', checked "Microsoft Data Access Components Installed Version", to include it with the other 5 checked references -- no luck;

same
compile error. I went to the Microsoft site and tried to download it, but installation was halted because it was "already installed". Could there

be
a conflict between any of the 6 References? Short of starting over, is

there
anything else I should be looking at/for in the References or code?


Try unchecking
"Microsoft ActiveX Data Object Recordset 2.7 Library"
and checking
"Microsoft ActiveX Data Object 2.7 Library"

Aren't you going to have problems when you get to the line

rs.Open "CounterTab le", CurrentProject. Connection, adOpenKeyset...

in an Access 97 application? CurrentProject?



Nov 12 '05 #5
"Earl Anderson" <is*****@rcn.co m> wrote in
news:40******** **************@ news.rcn.com:
That took care of the "User-defined type not defined" error and
yes, I did get the error on 'CurrentProject ' and declared that
also.


May I ask why you're using ADO in A97?

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 12 '05 #6
rkc

"Earl Anderson" <is*****@rcn.co m> wrote in message
news:40******** **************@ news.rcn.com...
That took care of the "User-defined type not defined" error and yes, I did
get the error on 'CurrentProject ' and declared that also.


So the function is working now?
The problem is that there is no CurrentProject in an A97 application.
Your solution is probably to re-write the function you found so that
it uses DAO in place of ADO.
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2715
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through VS, however, when I change to release and put it out on the web it fails giving me the following error message The underlying connection was closed. Could not establish a trust relationship with the remote server.
2
5287
by: Nigel Frost | last post by:
I have a .Net console application. It creates a user's folder, sets permissions using WMI, then fails to give the ownership of that folder to the user (for quotas). This all executes on a single 2003 server, within a larger domain. My admin account, from which I run the app, and the user's account, are both AD domain accounts. Seems simple enough, and it works fine with a VB script from the console. However, when I run my C# .Net app,...
5
310
by: Martin Robins | last post by:
I have never dabbled with ASP.NET until now so be warned! I have created a web application with the single default form: WebForm1.aspx and when I try to display it I get this error. My understanding was that ASP.NET was supposed to set itself up, especially as I am using Windows Server 2003. Can anybody give me instruction as to resolution; what folder should I be granting the access to? The path shown only exists as far as the...
6
3562
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html error page. All six steps in the article work just fine. Then at the end of the article, there is a little comment about redirecting errors to an aspx page (instead of an html page):
13
2277
by: Edward Mitchell | last post by:
I have a problem that involves the error I receive when attempting to complete the asp.net web application example (Walkthrough: Creating a Web Application Using a Third-Party Business Object). When I first create the SQL connection in VS.NET 2003, I test the connection and everything works fine. However, when I attempt to run the first stage of the app (the bound datagrid), I receive an error stating: login failed for user...
8
7834
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the VALUE ENTERED BY THE USER EXISTS IN THE DB , then THE ERROR MESSAGE OF THE COMPARE VALIDATOR SHOULD BE DISPLAYED. For this, I used the reference artiicle "http://msdn.microsoft.com/library/default.asp?url=/library/en-...
2
3349
by: hansiman | last post by:
I'm wondering how best to present exception messages to a user. In a try catch I catch an OleDb.OleDbException. The error could be a COLUMN REFERENCE constraint error (by a deletion attempt). The normal user would not know what to make of the standard error message (exOleDb.Message) and I'm not sure how best to use the the exOleDb.ErrorCode (-2147217873)? Is best practise to present the user to a general message like "An SQL
6
10483
Cyberdyne
by: Cyberdyne | last post by:
Hi guys, I have a windows 2003 sbs server running about 25 client licenses and here is my little problem my pop3 connector is throwing an error at me several times per day, although the system itself works and everybody gets their e-mails! Its all the same pop3 connector error except there are 4 event variations Error 1 Event 1019 The message download process finished with one or more errors. For more information, see Help and...
2
2313
by: jthep | last post by:
I'm trying to get this piece of code I converted from C to work in C++ but I'm getting an access violation error. Problem occurs at line 61. Someone can help me with this? The function display(llist mylist) displays a list of choices for a record book: void display(llist mylist) { char name, address, telno, input; int yearofbirth, choice, records; yearofbirth = 0;
5
3557
by: Cirene | last post by:
I just deployed my new ASP.NET (3.5 FW) site to the hosting company I'm using, webhost4life. NOTE: I HAVE deployed other SQL Server sites to the same account with no issues. Now I'm getting this error. Any idea why? Server Error in '/myuser4/MyWebApp' Application. --------------------------------------------------------------------------------
0
8815
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8713
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9187
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7960
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5961
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2113
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.