Results 1 to 2 of 2

Thread: problems with database (related to ini files)

  1. #1
    Guest
    i have another problem..
    i tryed to make my program locate the database name for data1 from an ini file. i made the ini file tell where the data.mdb file is and yet i get an error massage. this is the massage: "object variable or with block variable not set". do you know why i get the error or what it means? .. thanks..

    someone told me i need to declare a variable im using.. but i didnt thats not enough information for me..

    this is the code i use (this code reads database faster )

    SIniFile = App.Path & "\CharGen.ini"
    Dim sBuff As String * 255
    n% = GetPrivateProfileString("Database", "Path", "DefaultPath", sBuff, Len(sBuff), SIniFile)
    Data1.DatabaseName = sBuff
    Data1.Recordset.MoveLast
    intRecCount = Data1.Recordset.RecordCount
    Data1.Recordset.MoveFirst

    For intCounter = 1 To intRecCount
    List2.AddItem Data1.Recordset!Description
    Data1.Recordset.MoveNext
    Next intCounter


    thanks

  2. #2
    Guest
    You can try this. you have forgoten to refresh the data1 object.

    \* ================================================

    Data1.DatabaseName = Database file
    Data1.Refresh

    \* ================================================

    Data1.Recordsource = SQL here or the Table name
    Data1.Refresh

    \* ================================================

    -Kayoca Mortation

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