Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URGENT: Access 2000 with Data Control Coding in VB 6 error

Status
Not open for further replies.

Jupbs

MIS
Jun 17, 2003
29
BD
Hi,
I was using Access 97 and now I have converted my database into Access 2000. I have changed my provider into OLEDB 4.0. In the Form Load event I have set the datasource of the Data Grid. Now its giving me an Error. It says cannot initialize.....but I have already tested it in the design mode and its showing me the data properly at run time. But when I am connecting it at the run time it gives me that error. Pleas help me its urgent.
 
This is probably a silly question but are you running it in design time and run time on the same PC? What code/message does the Err.Number and the Err.Description return?
 
Please check whether you have adodc1.refresh after setting the record source.
 
Hey,
thanks for the replies. But I have solved my problem. Yes I am running it in run time and design time at the same machine. The error was at run time after binding with the data grid control data source, Data grid control cannot rebind. Then I figure it out that for the Access 2000 you have to set your curser location. The codes are as follows.

Private Sub Form_Load()

Dim db As ADODB.Connection
Dim rs As New ADODB.Recordset

db = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Cashpor Accounting Module\Data\Cashpor Master Accounting Database.mdb;Persist Security Info=False"

rs.CursorLocation = adUseClient
rs.Open "AccountCode", db, adOpenKeyset, adLockPessimistic

Set DataGrid1.DataSource = rs
DataGrid1.ReBind
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top