Click to See Complete Forum and Search --> : ADODC not starting at beginning of DB


mrhicks
March 21st, 2001, 08:46 PM
Hello all,

I have a question, I have a form with a bunch of controls ( check boxes, text boxes etc.. ) and one ADODC control. Each of the controls on the form are binded to the ADODC in some fashion by setting its DataSource and DataField to the corresponding field in the database table. Everything seems to work fine, but when I load and run the program the ADODC control doens't seem to start with the first entry in the database table which has a Primary Key Value of 194 ( it starts at 34 ). It goes all the way to the end, but I can't figure out why it is not starting at the first Primary Key value.

Here is the connection string


Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\programming\myfiles\Visual Basic\Archive Tool v0.0.1\archiveDB.mdb;Persist Security Info=false




The record source is set to 2 - adCmdTable which points to a valid table in the database. Anyone have any thoughts? Also, in the ADODC caption I want to display the current record out of the max number of records ( something like 3 of 500 ). I can't figure out how to determine which record is currently selected or the max number of records in the database. I have tried using the pRecordset from the WillMove method, but can't find anything worth while in that struture. There is a MaxRecords property, but that doesn't return the maxmium number of records in the table. Any thoughts on this subject? Thanks



private Sub Adodc1_WillMove(byval adReason as ADODB.EventReasonEnum, adStatus as ADODB.EventStatusEnum, byval pRecordset as ADODB.Recordset)





Mark Hicks

Iouri
March 21st, 2001, 09:19 PM
Because Primary key applies to the table of your database. ADODC is linked to your just created recordset. When rs was first created records entered there in the order that they were in the table. When you added anotherr record to the recordset, it was added to the end of the recordset. If you want see them in order, write this record to the table and refresh the adodc.

Iouri Boutchkine
iouri@hotsheet.com

mrhicks
March 21st, 2001, 11:18 PM
Ok, I kind of follow what you are stating, but I am never going to enter a new record into the table, I only want to view the existing data. Right now, when the application lanches it starts as 194 as I stated in the first post and as you click the right facing button on the ADODC control it increaments in a sequential order all the way to the end which is around 545. It just misses the first 100 records for whatever reason.


Is there a way to force the ADODC control to create a new record set pointing to the first record in the table?

Mark

mrhicks
March 23rd, 2001, 04:05 PM
Hello all,

FYI for those that are interested, I did figure out what I could do to correct the problem. Instead of doing a Command Type of adCmdTable and selecting the table, I picked adUnknown and entered a query string, but using the ORDER BY the Key field. After doing this it worked like a charm.

Mark