I have a table [ETL_TBL]
and I want to do a count of the number of records where the field [ERR_DESC] is not Null
I have been trying to write a recordcount code. can anyone help me in how to write this. My specific problems are in writing the criteria.
6 2962
I have a table [ETL_TBL]
and I want to do a count of the number of records where the field [ERR_DESC] is not Null
I have been trying to write a recordcount code. can anyone help me in how to write this. My specific problems are in writing the criteria.
Try out this. I am assuming that you are using ADODB
[HTML]
If MyRs.State = adStateOpen Then MyRs.Close
'Myrs is the recordset
MyRs.CursorLocation = adUseClient
MyRs.Open "select count(*) from ETL_TBL where ERR_DESC IS NOT NULL", MyCon, adOpenDynamic, adLockOptimistic
'Mycon is the connection
Text1.Text = MyRs.Fields(0)[/HTML]
Good luck
I have a table [ETL_TBL]
and I want to do a count of the number of records where the field [ERR_DESC] is not Null
I have been trying to write a recordcount code. can anyone help me in how to write this. My specific problems are in writing the criteria.
-
dim rsTemp as new ADODB.recordset
-
dim conntemp as new ADODb.Connection
-
' set the Connection String to the Connection Object.
-
if rstemp.state=adstateopen then rstemp.close
-
rstemp.open"Select count(*) as cnt from ETL_TBL where ERR_DESC<>Null",contemp
-
-
Msgbox"total Record=" & rstemp.fields("cnt").value
-
-
dim rsTemp as new ADODB.recordset
-
dim conntemp as new ADODb.Connection
-
' set the Connection String to the Connection Object.
-
if rstemp.state=adstateopen then rstemp.close
-
rstemp.open"Select count(*) as cnt from ETL_TBL where ERR_DESC<>Null",contemp
-
-
Msgbox"total Record=" & rstemp.fields("cnt").value
-
Thanks for everyone's great help.
I tried this code: - Function REC_COUNT_TEST_2()
-
-
Dim rsTemp As New ADODb.Recordset
-
Dim conntemp As New ADODb.Connection
-
' set the Connection String to the Connection Object.
-
If rsTemp.State = adStateOpen Then rsTemp.Close
-
rsTemp.Open "select count(*) from ETL_TBL where ERR_DESC IS NOT NULL", MyCon, adOpenDynamic, adLockOptimistic
-
-
MsgBox "total Record=" & rsTemp.Fields("cnt").Value
-
-
End Function
-
But it gives me an error:
'Arguments are of the wrong type, are out of acceptable range, or are in conflict with another"
Any ideas?
again, thanks os much
What is the field type of field ERR_DESC? Text?
Also, just in case we're overlooking something, which line produces the error?
What is the field type of field ERR_DESC? Text?
Also, just in case we're overlooking something, which line produces the error?
Yes, it is a text field
Thanks for everyone's great help.
I tried this code: - Function REC_COUNT_TEST_2()
-
-
Dim rsTemp As New ADODb.Recordset
-
Dim conntemp As New ADODb.Connection
-
' set the Connection String to the Connection Object.
-
If rsTemp.State = adStateOpen Then rsTemp.Close
-
rsTemp.Open "select count(*) from ETL_TBL where ERR_DESC IS NOT NULL", MyCon, adOpenDynamic, adLockOptimistic
-
-
MsgBox "total Record=" & rsTemp.Fields("cnt").Value
-
-
End Function
-
But it gives me an error:
'Arguments are of the wrong type, are out of acceptable range, or are in conflict with another"
Any ideas?
again, thanks os much
hi,
you use the code -
rsTemp.Open "select count(*) from ETL_TBL where ERR_DESC IS NOT NULL", MyCon, adOpenDynamic, adLockOptimistic
-
Again u use the code -
MsgBox "total Record=" & rsTemp.Fields("cnt").Value
-
Now U tell me where is the "cnt" field???--->thats the error
just use -
MsgBox "total Record=" & rsTemp.Fields(0).Value
-
check it. good luck.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jules |
last post by:
Is anyone able to translate the following PHP to ASP ? or come up with
something that would work.
The reason for the code is that I'm using Indexing service to create a
search engine on a...
|
by: Mark Watkins |
last post by:
I know for a fact that in my database, I have three records under the users
table. However when I execute this code:
--------------BEGIN CODE----------------
Set objConn =...
|
by: Phil Powell |
last post by:
I am not sure why this is producing a SQL Server related error, but w/o
having an instance of SQL Server on my machine to verify anything further,
can you all help me with this?
<!--- validate()...
|
by: Martin Franklin |
last post by:
I am trying to get a total record count on a Acess 97 mdb database. However
I get the following error when I try to load the page:
Provider error '80040154' Class not registered...
|
by: scott |
last post by:
In LISTING 2, I have a SPROC that returns a recordset and a recordcount in
SQL QA. I can access the Recordset with no problem. How can I grab the
Recordcount with ASP code at the same time I'm...
|
by: tym |
last post by:
HELP!!!
I'm going round the twist with this...
I have a VB6 application which is using DAO to access a database
(Please - no lectures on ADO, I know what I'm doing with DAO!!)
Ok, problem...
|
by: kev |
last post by:
Hello,
I posted a question a while ago on tabbed pages, how to set it to
invisible when the text box is empty.It was answered by Rick and the
code ran perfectly. However, i tried using the same...
|
by: troy_lee |
last post by:
I have two fields on a form. These two fields' values are based on an
expression and represent a date range. I need to create a SQL
statement that will use the returned values of these two fields...
|
by: timber910 |
last post by:
Ok, I have a button on a form that I'm using to create another table I will need later in my form. I have created a reference table called Ref_Table (holds my table names - using this as the tables...
|
by: Orbie |
last post by:
Hi All,
I'm new to VB.NET and i'm looking for some help with my Windows Form. I need to check if a Commodity entered into (TextBox1.Text) already exists on my table before i insert it. I'm having...
|
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: 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,...
|
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: 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...
|
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,...
| |