Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Get Total Number Of Records Of Records Return By Recordset?


I wanna get the total number of records returned by the record set. I used RecordCount, but it always return -1. some 1 plz help me out.Dim cnn as ADODB.Connection Dim ars as ADODB.Recordset set cnn = new ADODB.Connection With cnn .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:MapData.mdb;Persist Security Info=false" .Open End With Dim SQL as string SQL = " Select * from Education" set ars = cnn.Execute(SQL) MsgBox ars.RecordCount 'NOR WORKING???...---.....Hassan ZiaHassan_Zia@mathtech-pk.com




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Get The Total Number Of Records In A Table?
Hi,

How can I get the number of records inside an access table?
I think I should use MoveLast, but I don't remember the correct way to do that...

Thanks for any help...

Michel Jr.

Access - Finding/getting Total Number Of Records.
Ok, I have a query that searches a massive table by the date. It then displays only unique values for that date. So basically, it takes a total of 500+ records and filters it down by the date entered; comes out to about 100 records per day. Then, it filters once more by unique values in the "Operator ID" field; comes out to about 20-50 different ID's. The main purpose behind my need is to figure out how many users were on for that particular day.

Anyway, I have the query already set up how it should be. I looked in MSDN and Access Help to find some way to count/sum the number of rows, but I can't seem to get anything to work. It's kinda hard for me to explain (still early in the morning here), so I've attached a few screenshots of what I have going on. If you need a better explanation, please let me know.

Thanks!

Total Number Of Records To Be Passed To A Variable
I am accessing Oracle from VB. I just want to pass the value into a variable from VB. Anyone can help me.

eg.:
select count(*) from Customer where City ='TOKYO';

Count(*)
--------
450

I want this 450 to a variable which I defined in VB.

Dim myCount as Integer
set cmdobj = New command
With cmdobj
.activeconnection ="CN"
.commandtext="select count(*) from Customer where City ='TOKYO'"
.execute
end with

mycount = ??

Please help me.
Thanks

my yahoo id is : taurus72dil@yahoo.com

Recordset Object Does Not Return All Records
Hi,

I have this code which seems to work nicely for loading an Access Database and displaying the contents in a List Box for processing :

Code:
Option Explicit

Private cn As ADODB.Connection 'this is the connection
Private rs As ADODB.Recordset 'this is the recordset
Private ptrPos As Integer
Private newPos As Integer


Private Sub Form_Load()

Set cn = New ADODB.Connection

cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:Program FilesShipDBShip Database.mdb;" & _
"Mode=Read;Persist Security Info=False"
cn.Open

Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient

rs.Open "SELECT * FROM ShipDatabase", cn, adOpenKeyset, adLockPessimistic, adCmdText

rs.Sort = "ShipName"
rs.MoveLast
rs.MoveFirst

Do Until rs.EOF = True
lstShipName.AddItem rs!ShipName
cboIMO.AddItem rs!IMONum
rs.MoveNext
Loop

rs.MoveFirst
lstShipName.Text = rs!ShipName

FillFields

End Sub

My problem is that my Access database has 603 records, but the code above returns and displays the first 600 (The recordcount method confirms only 600 records are seen).

Any ideas on why the records over 600 do not appear?

Thanks for any help
Dave


Edit by Moderator:
Please use the [vb][/vb] tags when you post your code. Edit or reply to this post to see how.

Thank you.

How To Dispaly Records Return From Recordset In Data Grid
I want to display records return from recorset in datagrid.How to do this?


Urgent

Trying To Return Recordset From Oracle Ver.7.3 And Getting Error "Cannot Bind PL/SQL Records Or Curs
I'm trying to get the hang of returning recordsets via a package from oracle and I keep getting the error "Cannot bind PL/SQL Records or Cursor References". Below is the asp code as well as the pl/sql. Thanks for the help!


dim cnn, cmd, rs, terr_num

terr_num = "0106"

set cnn = server.CreateObject("ADODB.Connection")
cnn.Open(Application("RCOM_CONNECTION_STRING"))

set cmd = server.CreateObject("ADODB.Command")
cmd.CommandType = adCmdText

set cmd.ActiveConnection = cnn
cmd.CommandText = "{ call DCARS.PKS_TEST_STORED_PROC.GetRecs(?,?) }"
cmd.Parameters(0) = terr_num

set rs = server.CreateObject("ADODB.Recordset")
rs.CursorType = adOpenStatic
set rs.Source = cmd
rs.Open

Response.Write "<TABLE><TR><TD>"
rs.GetString adClipString,,"</TD><TD>", "</TD></TR><TD>", " "
Response.Write "</TD></TR></TABLE>"

set cmd = nothing
rs.Close
set rs = nothing
cnn.Close
set cnn = nothing




--**************PL/SQL******************

-- ********************Package Specification************************
Package DCARS.PKS_TEST_STORED_PROC
IS

cursor c1 is
SELECT I.prod_line_code,
C.model_number,
I.invoice_number,
I.invoice_date,
D.region_code||D.region_dealer_num D_Code,
D.Dealer_Name,
A.city,
A.state_code,
S.unit_status_code UnitStatus,
I.invoice_stat_code
FROM compitem C, serunit S, invoice I, dealaddr A, dealer D;

type Results is ref cursor return c1%rowtype;

PROCEDURE GetRecs(terr_num IN varchar2, result_set IN OUT Results);
END; -- End Package Specification

--****************Package Body*******************


Package Body DCARS.PKS_TEST_STORED_PROC
IS

PROCEDURE GetRecs(terr_num IN varchar2, result_set IN OUT Results)
IS

BEGIN
open result_set for
SELECT I.prod_line_code, C.model_number, I.invoice_number,
I.invoice_date, D.region_code||D.region_dealer_num D_Code,
D.Dealer_Name, A.city, A.state_code,
S.unit_status_code UnitStatus,
I.invoice_stat_code
FROM compitem C, serunit S, invoice I, dealaddr A, dealer D
WHERE I.invoice_number = S.invoice_number
AND A.default_ship_flag = 1
AND A.region_code = D.region_code
AND A.region_dealer_num = D.region_dealer_num
AND (I.invoice_stat_code = 'O' OR S.unit_status_code = 'DP')
AND C.catalog_number = I.mu_catalog_num
AND S.serial_number = I.mu_serial_num
AND S.catalog_number = I.mu_catalog_num
AND I.invoice_type_code = 'N'
AND I.invoice_lob_code = 'M'
AND I.region_code = D.region_code
AND I.region_dealer_num = D.region_dealer_num
AND territory_number = terr_num
GROUP BY I.prod_line_code, C.model_number, I.invoice_number,
I.invoice_date, D.region_code||D.region_dealer_num,
D.Dealer_Name, A.city, A.state_code, I.invoice_stat_code,
S.unit_status_code
ORDER BY I.prod_line_code, C.model_number, I.invoice_date DESC;
END;

END; -- Package Body PKS_TEST_STORED_PROC

Count Number Of Records In Recordset
Hello,

How can I count the complete number of records that exist in a recordset?

Thank in advance.

Best Way To Get The Number Of Records In A File With Millions Records
Hi all,

I have searched the threads looking for a way to get the total number of records in a file in one shot.

It looks like Split function into an array and using UBound is the answer.

However, I have a file that contains millons of records and that may be a problem.

Question: Is there another way of geting the total number of records in a file in one shot?  Note that each line is delimited by vbLF.

Thanks in advance for any help.


How Can I Know The Total Amount Of Records? (Using GET/PUT)
Hi Guys!

I'm making an app using get/put and a Type that handles details on people, names, age, etc...

Now, my question is, how can i have my app tell me how many entries or people are saved on the file, or the number of records?

Heres a small example of how the info is saved:

GENT.Name = Text1.Text
GENT.Age = Text2.Text
Put #1, REC, GENT

The REC variable tells the app which record to save to.
GENT is the type i made.

How can I know the total amount of records?

Thanks a lot!!!

Getting Total # Of Records In VB For Access
Im trying to get the total # of records in Access through a VB Module. How Do I Do it through VB?


Example,.... I have a table called visits. Basically, I need a function that looks something like this:

Function TotalRecords()

TotalRecords = Visits.TotalNumberOf RecordsInThisTable

End Function



Simple enough...... huh?!

Access - Getting Total # Of Records From Query
Ok. I have a bunch of queries set up for various things. I'm trying to add a few enhancements and eye-candy to what I'm doing so this really isn't important if it cannot be done. I have my query set to filter some things in the Criteria. What I would like to do is get the total number of records from the updated query. Is there any way to do this?

***Sorry if I'm not making any sense. It's still early in the morning.***

Find Total No. Of Rows With Records
How do i check the no. of rows that contains records in excel using VB?

Calculate Percentage Of Records Vs. Total
I have a SQL statement currently running that gives the total number of letters created and sorts the records by user name.

eg.

Name Total
UserA 4
UserB 2
UserC 3
UserD 1

So, the total would be 10 records. I'm trying to figure out the SQL statement to figure a percentage, but I'm pulling hair and not getting very far. What I have so far is this:

SELECT ((SELECT LetterData.UserName, Count(LetterData.Case) AS CountOfCase
FROM LetterData
GROUP BY LetterData.UserName) / (SELECT Count(LetterData.Case) AS CountOfCase
FROM LetterData)) As Percentage
FROM LetterData
GROUP BY LetterData.UserName

What I'm trying to get is:

Name Total Percentage
UserA 4 40
UserB 2 20
UserC 3 30
UserD 1 10

I'm running this in Access and it keeps giving me an error stating the SELECT statement will return more than one record. Am I going about this the wrong way? Any help would be great!

Getting Total No Of Records Present In A Table
Hello Friends,

I am doing a project in Vb 6.0 using access as the backend
Here i have a particular table named Table_Of_Weightage has two fields only and looks like this

Rem_Abbr Rem_Weight
Ars 0
Bov 10
Gels 5
Act-r 4

Where Rem_Abbr=Abbreviations of the medicines used in Homeopathy
Rem_Weight=Weightage being given to each medicine on basis of coding

this table is not really the final table
what i am supposed to do is to get the entire two fields along with their data in a 2-D array every time on the click of a command button.
First for that i need to know what is the total number of records present in the table because medicines maybe added later on.
First Question is that how i am supposed to get the total number of records present using a recordset.And yeah i am using ADODB connections.
Only after doing all this would i be able to determine the number of elements in my array.
Would this declaration of an array be right

[CODE]

dim myarray(total no of records,2) as variant
[CODE]

since total no of records=no of rows
2=no of columns
variant because Rem_Abbr=text,Rem_Weight=integer
is this the right way of doing it????

PLease get back to me as soon as possible.
thanks
Niyati

Count Total # Of Records In A Text File
Modified from original..................

This code gives me count. But when I click on my rc button it doubles my count. So, first click it gives me 12 (and this is correct. i only have 12 records in my file), 2nd click gives me 24, 3rd click gives me 36 and then it breaks.



Code:
Private Sub cmdRC_Click()
Dim TextLine$, Filename$
Dim FileHandle As Integer

Filename$ = "c:Test.txt"

' Test if the file exists
If Len(Dir(Filename$)) = 0 Then

'If Dir(Filename$) = "" Then
Exit Sub
MsgBox "File Not Found", vbCritical
Else
FileHandle = FreeFile ' This is safer than assigning a number

Open Filename$ For Input As #FileHandle

Do While Not EOF(FileHandle) ' Loop until end of file
Line Input #FileHandle, TextLine$ ' Read line into variable
NumRecords = NumRecords + 1
Loop

MsgBox NumRecords

Close #FileHandle

End If

End Sub

Finding Total Records Out Of Type In Array
Hello All !!!

I need to find out the the total records out there from an Array of Types during run-time..

My Type Declaration is sw. like this

Type tagMyType
sName as STRING*50
sAddress as STRING*100
sEmail as STRING*25
.........................
.........................
End Type

Dim Profile(1 to 100) as tagMyType

I can use 100 as the UpperBound but.. what if I have only some 15 records in the Type..

Isn't there something like UBOUND like in Array??

Thanks in Advance...

SQL Inner Join Return Unasked Records
SELECT *
FROM Recon INNER JOIN ownRecon ON Recon.tktnumber= OwnRecon.Description
WHERE recon.nettamt > 0.00 or recon.nettamt < 0.00 AND Recon.NettAmt = ownRecon.OwnAmtDebit OR ownRecon.OwnAmtCredit

ReconIDTktNumberNettAmt

5913063409647(R328.78)

ownReconID Description AmtDebit AmtCredit

652 3063409647R0.00R328.78

I don't want these amounts in my Query because the amounts don't match. These are actually 6 records returned from 2 tables of which two pairs are the same but the 3rd pair(+ and -) I want to leave out.

What SQL will do? and how do I use the SUM statement in above statement to get one row TotalAmt(AmtCredit+AmtDebit) per repeated Description. Then I will work with one amount TotalAmt per Description.

Thanks

Crystal Reports Return Min And Max Records
Hello all,
This question should be easy but for some reason it eludes me. I am trying to create a Crystal report (version 8.5) that looks up records in 2 tables based on a record ID. I have a primary table that holds “header” information and another table that holds the detail with a one to many relationship. I want to be able to query all the records on both tables and display the information. The detail table has a status, requesting department and a date_time field. Using the status and date_time fields, I want to use a function that looks up the maximum date_time and displays the (current) status. I then need to be able to display the requesting department based on the minimum date_time.

I would appreciate any help. Thanks!

SQL Query Does Not Return Expected Records
I've got a very simple SQL query that is not returning all the records it should return.

Here's how I set the database connection:

CODEDB.Mode = adModeReadWrite
DB.Open "Provider=MSDASQL;Driver={Microsoft Paradox Driver (*.db )};" & "DriverID=538;" & "Fil=Paradox 7.X;" & "DefaultDir=" & MyDatabasePath & ";" & "Dbq=" & MyDatabasePath & ";" & "CollatingSequence=ASCII"

SQL Query To Return Records With Latest Date.
I'm having trouble figuring this out.  Perhaps it is so simple I am making it harder than it needs to be...

I have a table with employee schedules.  Each record has SSN, Schedule start date, Sat, Sun, etc. and some others.  Each time an employee changes schedule there is a new record added.  So the current schedule the employee is on will have the most recent date in the record.  Previous schedules will have older dates.

How can I write a SQL query to retrieve only the records with the most recent date (which would be their current schedule).  This would be pulling schedules for all the distinct SSN's in the table.

Thanks.

Query Run Successfully In Sql*plus But Return 0 Records Affected In Vb6
I've did a program using vb6 to connect to oracle9i, i can establish the connection, the problem is when i execute the query in oracle sql*plus, it can execute successfully, but when run in vb application, the records affected return 0, it do nothing for this query, any setting need to be done?
because this query insert and select to/from different database, i've created a database link for these 2 database, everything work find in oracle sql*plus.

thanks for help..

Code:
db.Open "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;USER ID=max;PASSWORD=max;Data Source=oracledb"

sSQL = "INSERT INTO FWDINVOICE_DET@ORACLEAR (COMPANYCODE,BRANCHCODE,INVOICENO,JOBNO,CHARGECODE)" & _
" (SELECT FWDINVOICE_DET.COMPANYCODE,FWDINVOICE_DET.BRANCHCODE," & _
" FWDINVOICE_DET.InvoiceNo,FWDINVOICE_DET.JobNo,FWDINVOICE_DET.ChargeCode" & _
" FROM FWDINVOICE_DET@ORACLEDB,FWDINVOICE_HD@ORACLEDB" & _
" Where FWDINVOICE_HD.CompanyCode = FWDINVOICE_DET.CompanyCode" & _
" AND FWDINVOICE_HD.BRANCHCODE=FWDINVOICE_DET.BRANCHCODE" & _
" AND FWDINVOICE_HD.INVOICENO=FWDINVOICE_DET.INVOICENO" & _
" AND ( FWDINVOICE_HD.CANCEL= 'Y' OR FWDINVOICE_HD.APPROVED='Y') AND "
sSQL = sSQL & oLib.SQLRangeDate("FWDINVOICE_HD.InvoiceDate", Format(dtDateFrom, "dd-MMM-yyyy"), Format(dtDateTo, "dd-MMM-yyyy"))
sSQL = sSQL & ")"

sSQL = UCase(sSQL)
db.Execute sSQL




Edited by - hercules129 on 11/28/2006 11:47:56 PM

Query Run Successfully In Sql*plus But Return 0 Records Affected In Vb6
I've did a program using vb6 to connect to oracle9i, i can establish the connection, the problem is when i execute the query in oracle sql*plus, it can execute successfully, but when run in vb application, the records affected return 0, it do nothing for this query, any setting need to be done?
because this query insert and select to/from different database, i've created a database link for these 2 database, everything work find in oracle sql*plus.

thanks for help..


Code:

db.Open "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;USER ID=max;PASSWORD=max;Data Source=oracledb"

sSQL = "INSERT INTO FWDINVOICE_DET@ORACLEAR (COMPANYCODE,BRANCHCODE,INVOICENO,JOBNO,CHARGECODE)" & _
" (SELECT FWDINVOICE_DET.COMPANYCODE,FWDINVOICE_DET.BRANCHCODE," & _
" FWDINVOICE_DET.InvoiceNo,FWDINVOICE_DET.JobNo,FWDINVOICE_DET.ChargeCode" & _
" FROM FWDINVOICE_DET@ORACLEDB,FWDINVOICE_HD@ORACLEDB" & _
" Where FWDINVOICE_HD.CompanyCode = FWDINVOICE_DET.CompanyCode" & _
" AND FWDINVOICE_HD.BRANCHCODE=FWDINVOICE_DET.BRANCHCODE" & _
" AND FWDINVOICE_HD.INVOICENO=FWDINVOICE_DET.INVOICENO" & _
" AND ( FWDINVOICE_HD.CANCEL= 'Y' OR FWDINVOICE_HD.APPROVED='Y') AND "
sSQL = sSQL & oLib.SQLRangeDate("FWDINVOICE_HD.InvoiceDate", Format(dtDateFrom, "dd-MMM-yyyy"), Format(dtDateTo, "dd-MMM-yyyy"))
sSQL = sSQL & ")"

sSQL = UCase(sSQL)
db.Execute sSQL

.net Database Connection - Return Records Into A Text File
How do I connect to an acces database using a DSN connection and return the records of the table STUDENTS in VB.NET?

select * from students... etc. I know how to do it in VB6 but it's all new in .NET, does anyone hav a good tutorial on how to do this? etc.
Thanks.

Recordset BOF &amp; EOF Both True Thou' Recordset Contains Records
I have a recordset with at least one record in it, it is triggering an 'EOF or BOF is True' error when using .MovePrevious or .MoveNext.

Putting the IDE in break mode and analising the values of EOF and BOF in the Immediate Window show them both to be True.

There are records in the recordset and I have confirmed this by analising the Database file directly.

How can BOF and EOF both show True other than when the RecordSet of Empty?

I am using ADO with the Jet Engine 3.41.

Please help, I can't figure out what is going on.

How To Add Records Return From Query Directly In Combo Box Or List Box Without Using Loop
hello myself avi developing application in vb and sql server 7
i have customermaster table in which i have atleast 500-2500 records .i want to add all that records in combo box or list box without using loop.
below is my code please do the proper correction or suggest

StrSQL = ""
         StrSQL = "Select * From Customermaster where Subgroup=29 order by accountname"
         RsNames.Open StrSQL, Conn, adOpenKeyset
         txtCreditTo.Clear
         Do While Not RsNames.EOF
               txtCreditTo.AddItem RsNames("AccountName")
               RsNames.MoveNext
          Loop
          RsNames.Close

Number Of Records
How do i find out how many records i have in a specific access db table?

Number Of Records...
Hey all, I just have a quick question. How do you check the number of records in a ADODB recordset (I have tried RecordSet.RecordCount, it's a no-go). I'm sure it's just something simple, I just can't seem to find it...

~Mike

Number Of Records
How to I sum particular set of fields called hours when there are 1 to N number of records with a particular matching field called login? Thanks guys and girls

janderson

Number Of Records
Hi
I have a very large database(SQL server 2000 with over 500000 records) and I want to know the number of records that have the date field between 2 distincts dates

VB Code:
Str = "Select * from Finance where Pdate between '" & sdate1 & "' and '" & sdate2 & "'"Rs3.Open Str, cnn, adOpenStatic, adLockOptimisticnr = Rs3.RecordCount


When I choose a large date interval for sdate1 and sdate2 it's taking me too long to know the number of records.
Is there another way to find the total number of records?
thanks

Number Of Records
How do I show the number of records on the form?

When I begin I may have 100 records i.e. moving from next to previous.

Bus then I run a search and may only have 20 records in the search.

When I Select In Combo Related Records Display In Grid, Few Records Are Not Displaying
I think this is the right place to post this, without knowing i place this in other discussion.
I am new.

 Actually my project's Purpose [in the Form1, two combo boxes listing ItemCode and Description from two tables, where ItemCode is equal in both tables, after selecting in combo, the related record displayed in the Form2-MSHflexgrid]

   Everything is working perfectly except one thing. Only three records is not displaying the details among the 1600 records
OFFICE 2000 W32 EN INT'L
MONEY 2000 W32 ENG INT'L
COMPAQ PRESARIO MV500 15" MONITO . this 3 records are in the present in the table and the ItemCode is also equal. The 3 belongs to Description field. I check through in another way, by giving the Itemcode in the first combobox, it displays correctly the details of all records. where as in the second combobox only these three is strucking up.

where as PRESARIO MV500 15" MONITOR is also a record similar to the three records but it is displaying.
I don't know this is because of any string error or something else. What's the problem, Kindly reply me.


Form_Activate()

    If Form1.optItemcode.Value = True Then
sqls= "selecttab1.Itemcode,tab1.Description,tab1.Product,tab2.warehouse,tab2.Qty,tab2.Amt,tab2.Amt * 5/100 from tab1,tab2 where tab1.Itemcode=tab2.Itemcode AND tab1.Itemcode='" & Form1.cmbItemCode.Text & "'"
    End If

    If Form1.optDesc.Value = True Then
sqls="select tab1.Itemcode,tab1.Description,tab1.Product,tab2.warehouse,tab2.Qty,
tab2.Amt,tab2.Amt * 5/100 from tab1,tab2 where tab1.Itemcode=tab2.Itemcode AND tab2.Description='" & Form1.cmbDescription.Text & "'"
    End If
   
    rst.Open sqls, cnn, adOpenStatic, adLockReadOnly, adCmdText
If rst.RecordCount = 0 Then
       Me.Hide
       Form1.Show
       MsgBox "No Matching RECORDS !", vbExclamation, " * Invalid Entry"
End If

because of this I am not able to finish my project. Kindly help me. My mail id is

itchocks@rediffmail.com

Thank you very much,
CHOCK.


Hai !!!
Question:Also send it to my mail ID. I did'nt get practice with forums, I don't know where to search this again.

<HTML>
<B><font color="#008000">HAVE A NICE DAY !</font></B>
<HTML>

No Records In Recordset.
Why won't this work, I'm allowing the user to select a number of regions they'd like to view. Then based on the number of regions they've selected I'll filter out the stores found in these regions.
If the user selects 1 region there's no problem, though more than two I get no records in the recordset.



Code:
SELECT StoreName
FROM Stores
WHERE CTCode LIKE '010103____'
AND CTCode LIKE '010102____'
AND CTCode LIKE '010106____'
GROUP BY StoreName


Thanks

How Many Records In A Recordset
If I am getting a recordset like this:

VB Code:
Set conDatabase = CurrentProject.Connection    Set cmdCommand.ActiveConnection = conDatabase    cmdCommand.CommandType = adCmdText     'Set up the SQL statement    sql = "SELECT * FROM A'"    cmdCommand.CommandText = sql     'Execute the SQL, returning the value into a recordset    Set rs = cmdCommand.Execute


How can I find out how many records there are in teh recordset?

Cheers

How Do I Know How Many Records Are In A Recordset?
if I do:
set rs = cn.execute("select XXX.....")

then how do i know how many records are in the set?
is there any method call to do this?

Can't Add New Records To ADO Recordset
I am developing a ClientServer application using VB6SQL Server 2K.
I have a table called Master_Concat in my database,
ConcatID / tinyint (Primary key)
Category / nvarchar

I am using MS ActiveX DataObjects 2.6 library.
The connection string is as follows,
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=AVYA;Initial Catalog=dbRequests;"
conn.Open

To add new records, I open a recordset as follows
  SQL = "Select * from Master_ConCat ORDER BY ConCatID"
  rs.Open SQL, conn, adOpenDynamic, adLockPessimistic, adCmdText
  If NOT (rs.BOF AND rs.EOF) then
    rs.MoveLast
    i = rs!ConCatID + 1
  Else
    i = 1
  End If        
  rs.AddNew
  rs!ConCatID = i
  rs!Category = "XYZ"
  rs.Update
  rs.Close

Whenever I try to execute this code, I get the foll. error :

Current recordset does not support updating. This may be an error of the
provider or of the selected locktype.

Which provider should I use so that I will not get this error. Please specify an alternate method to accomplish the above task(I do not want to use Microsoft ADO Data Control).

Eagerly waiting for your replies.




Edited by - nikhilc78 on 5/13/2003 5:23:59 AM

Making A Retired Emplyee Records Inactive Instead Of Deleting His Records
I am developing a Payroll Software. Instead of deleting the records of a retired employee from the payroll, I want to make his records Inactive. This will allow the user of my program to be able to refer or recall the records of the retired employee if the need arises. I would want the retired employee's records to kept in an Arhive file if possible instead of deleting it completely.

I am totally ignorant of how to write the necessary codes.

I should be very grateful if you can help me out.

Thank you.
Akinyemi

Text Driven Query Doesn't Return Records Where Criteria Is First/Last Word In Record.
I am currently converting an old set of Access queries to a VB6.0 application. I am using DAO 3.51. The query is driven by text entered into one or more textbox(es). It works really well in Access, but I am having a hard time converting the SQL syntax in VB.

Here is the query from Access:

SELECT work.ntaID, work.taskdescription, work.taskdefinition
FROM work
WHERE (((work.taskdescription) Like "*" & [] & "*"));

Here is the query, which partially works (it will return records as long as the search criteria isn't the first or the last word in the taskdescription field):

qry = "SELECT * FROM work WHERE ntaID LIKE 'NTA 1*' AND taskdescription LIKE '* " & Text1.Text & " *';"

Sorry, if this is posted elsewhere.

Wrong Number Of Records
I have a random acces file that has user defined type records(4 of them to be more exact). I tried to get the number of records in it with this:


Code:
long_record_len = Len(user_defined_record)
long_file_len = FileLen(path_a)
long_nr_of_records = long_file_len / long_record_len
but returns me the wrong number of records(i have 4 and it shows me 6, i have 7 and shows 12).
The user defined data type looks like this

Code:
Type record
Ident As String * 10
Package As String * 7
Qty As Integer
File As String * 1
Address As Long
End Type
What can i do to get the right number of records?
THX

Access Records By Number
What is the function in VB that allows one to access a record by its number, NOT by match criteria such as in DLookup?

I know there's a way to do it by adding an autonumber column to the table that's being looped through using DLookup but I'm talking about other methods.

Trying To Find Number Of Records.....
i'm using a access database and i'm trying to find out how many records are in a table using vb. does anyone know how i would go on about doing this??

Number Of Records Question
MyRecSet needs to be changed to rRex

I tried this in my app, but it only returned the first record.


Dim oConn As ADODB.Connection
Dim rRex As ADODB.Recordset
Dim sql As String

'Init the objects
Set oConn = New ADODB.Connection
Set rRex = New ADODB.Recordset

oConn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "custdb.mdb"
sql = "SELECT customerid, SUM(ytdtotal) AS TotalCost FROM generators GROUP BY customerid"
'Fill recordset
Call rRex.Open(sql, oConn, adOpenKeyset, adLockOptimistic, adCmdText)

'Always be sure to use the .Value method to return the correct value.
SumTexttxt.Text = rRex.Fields("TotalCost").Value

'Shut everything down
rRex.Close
oConn.Close

'Impotant to clean up, too
Set rRex = Nothing
Set oConn = Nothing


Ah huh, It's because its not doing a do until .EOF type of thing?

This is my first incounter wuth ADO and at least it didn't throw an error at me.

Limit The Number Of Records
Hi
Is it possible to limit the number of records entered into a table to 10?
if the user wants to input more than 10 he gets a message box
If so how do i do it ?
thanxs in advance

ADO Control - Number Of Records?
Is it possible using the ADO control to get the number of records in the database? ive had a quick look through the ado functions and cant see any what i think would do it. Anyone have any ideas about this, or a possible solution?

SQl Table Max Number Of Records
Hi

How many records can an SQL server table support?Because I am planning to send the daily production to an SQL server table "Production 2006" and the average production is 500 records/day, and we have 360 Productions,so 360*500 would be a great number of records,isn't it?
if so,what's the solution

Get The Number Of Deleted Records
Is possible to get the number of the deleted records (in an Access db) when I run a typical execute command?(without running a select query first)


Code:

sqlCmd = "delete from mytable where id = 5 "
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = myConn
.CommandText = sqlCmd
.Execute
End With
Set cmd = Nothing

Selecting A Certain Number Of Records
Hi

Does anbody know a way of selecting records from an access database using ADO

e.g

records 300 - 550

Getting The Number Of Records Per Day *****RESOLVED***
I have a table that has a DateTime field that stores something like this "2004/01/19 16:16:15" which lets me know the date and time of the report. Now I need an sql statement that would let me know how many reports are being made per day. Can someone help me out?
This is what I've been doing(see sql), but I have to change the date and then run the query for a certain date. But I want one query that will give me the count on every date. I hope someone understands what I'm talking about. Thanks.

select * from Table where
DateTime >= '2004/03/01' and DateTime < '2004/03/01 23:59:59';




Edited by - xayavon on 4/22/2004 9:21:32 AM

How To Display The Number Of Same Records
HI, I want to know the code for display the same record in vb 6..For example i search for customer number 2444, but the records just to many and i want to show for example "There's 44 record for this customer"..Can somebody help me? Also i want to print that particular report..For example i have print button and when i click print it will print only one record..For example Customer number 2555 and only print that record..Thanks

How To Get The Number Of Records In A Datagrid
Hai there,

can anyone help me out with this problem.

In a project i'm using a datagrid to display the records .This is master/detail type of project.
My requirement is , I want to display the sum of the entries in one column into a text box.Can any one tell me how can get the number of records present in datagrid.Using visiblerows property will give number of rows visible.But it will not count the records which are not visible.

Please anyone help.

Copyright © 2005-08 www.BigResource.com, All rights reserved