Results 1 to 9 of 9

Thread: What could be wrong in this code ???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142

    Red face What could be the problem in this code ???

    I assign the data source of a dbgrid to the recordset as follow:

    Private Sub Form_Load()
    On Error Resume Next
    Dim rs As Recordset
    Dim crdatabase as Database

    sPath = "c:\db\cr.mdb"
    Set crdatabase = OpenDatabase(sPath)
    Set rs = crdatabase.OpenRecordset("cr")
    DBGrid1.DataSource = rs

    'add the field names in the list
    For Each fl In rs.Fields
    List1.AddItem fl.Name
    Next
    End Sub

    The problem is the dbgrid does not load any thing but the list works fine and all fields name are added...
    What could be the problem of that,,Any help..Thanks


    [Edited by maqmaq on 09-20-2000 at 02:05 AM]

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Are you using the OLEDB DataGrid?
    Have you tried connecting to it at design time?
    Are you getting an error?

    Please give more info. Also it should be:
    Code:
    Set DBGrid1.DataSource = rs

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    !I am using the Data Bound Grid Control 5 (SP3)
    !I am trying to connect at run time via the load of the form
    !The error I got when I remove the On Error Resume Next
    is: Class doesn't support Automation (Error 430)
    !I tried the code you mentioned and still the same problem and error

  4. #4
    Guest
    Try to put your code on "Private Sub Form_Active()
    not the Load.
    ( and let us know what happens :<) )

  5. #5
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Cool

    I think you just need to refresh your data before you assigne it to the dbgrid:
    crdatabase.Refresh
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    Thank you all for the participance!
    The only way to fix this was to save the Access2000 data base as previous version and it was OK
    Thank you again

  7. #7
    Lively Member Feras's Avatar
    Join Date
    Sep 2000
    Location
    Homs, Syria
    Posts
    85

    Arrow solution

    maqmaq, if you are using vb6 thin you just have to install service package 4 (SP4) which can be found at microsoft site.
    Yesterday is history ... Tomorrow is mistry .. Today is a gift.

    VB6 , intermidiat

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    Thank you Feras
    I downloaded the latest SPA, at http://msdn.microsoft.com/vstudio/sp/vs6sp4/default.asp
    Thank you
    maqmaq
    KSA

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Saudi Arabia, Gulf side, Qatif
    Posts
    142
    Feras
    When SPA4 installed, whenever I select new enterprise edition control project, the following error occured:
    System error.....No such interface supported..
    What could be the problem
    Thanks
    ,,,,,
    Feras
    I got the answer for the above problem in here:
    http://support.microsoft.com/support.../Q183/3/70.ASP

    I did not like to delete this message to keep it as a reference in future
    Thanks again

    [Edited by maqmaq on 10-07-2000 at 05:41 AM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width