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_Counter()
On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset
Dim NextCounter As Long
Set rs = New ADODB.Recordset
rs.Open "CounterTable", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
NextCounter = rs!NextAvailableCounter
If rs!FromYear < Year(Date) Then
rs!FromYear = Year(Date)
NextCounter = 0
End If
rs!NextAvailableCounter = NextCounter + 1
NextCounter = rs!NextAvailableCounter
rs.Update
MsgBox "Next available counter value is " & Str(NextCounter)
rs.Close
Set rs = Nothing
Next_Custom_Counter = NextCounter
Exit Function
Next_Custom_Counter_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 6 12723
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.com> 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_Counter() On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset Dim NextCounter As Long Set rs = New ADODB.Recordset rs.Open "CounterTable", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
NextCounter = rs!NextAvailableCounter If rs!FromYear < Year(Date) Then rs!FromYear = Year(Date) NextCounter = 0 End If
rs!NextAvailableCounter = NextCounter + 1 NextCounter = rs!NextAvailableCounter rs.Update
MsgBox "Next available counter value is " & Str(NextCounter)
rs.Close
Set rs = Nothing
Next_Custom_Counter = NextCounter
Exit Function Next_Custom_Counter_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
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*********@SeeSig.Invalid> wrote in message
news:40**********************@freenews.iinet.net.a u... 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.com> 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_Counter() On Error GoTo Next_Custom_Counter_Err
Dim rs As ADODB.Recordset Dim NextCounter As Long Set rs = New ADODB.Recordset rs.Open "CounterTable", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
NextCounter = rs!NextAvailableCounter If rs!FromYear < Year(Date) Then rs!FromYear = Year(Date) NextCounter = 0 End If
rs!NextAvailableCounter = NextCounter + 1 NextCounter = rs!NextAvailableCounter rs.Update
MsgBox "Next available counter value is " & Str(NextCounter)
rs.Close
Set rs = Nothing
Next_Custom_Counter = NextCounter
Exit Function Next_Custom_Counter_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
"Earl Anderson" <is*****@rcn.com> 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 "CounterTable", CurrentProject.Connection, adOpenKeyset...
in an Access 97 application? CurrentProject?
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.dabba.do.rochester.rr.bomb> wrote in message
news:ZV*******************@twister.nyroc.rr.com... "Earl Anderson" <is*****@rcn.com> 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 "CounterTable", CurrentProject.Connection, adOpenKeyset...
in an Access 97 application? CurrentProject?
"Earl Anderson" <is*****@rcn.com> 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
"Earl Anderson" <is*****@rcn.com> 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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). ...
|
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...
|
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).
...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |