Not an ASP question, but a VB question.

Results 1 to 2 of 2

Thread: Not an ASP question, but a VB question.

  1. #1
    Conrad Guest

    Default Not an ASP question, but a VB question.

    First off, I appologize for posting a non-ASP question here but I am getting rather desparate. I just fiquered quite a few of the ASP programmers might know VB.<BR><BR>Here is my problem:<BR><BR>I have written a VB program that uses Microsoft Access as it&#039;s database, however, we I complie/install/run it on a PC I get the following error:<BR><BR>Run-time error &#039;430&#039;:<BR>Class does not support Automation or does not support expected interface.<BR><BR><BR>Here is the code from where I believe the error is occuring:<BR><BR>&#039; Used to set the location of the worklist.mdb database<BR>Private Function ReSetDatabase() As Boolean<BR> &#039;On Error GoTo ErrHand<BR><BR> DlgOpenDatabase.Filter = "Access Database (*.mdb)&#124*.mdb"<BR> DlgOpenDatabase.ShowOpen<BR><BR> Dim objConnection As ADODB.Connection<BR> Dim strConnection As String<BR> Dim objRecordset As ADODB.Recordset<BR> Dim strSql As String<BR> Dim strDatabase As String<BR> Dim intCounter<BR> <BR> Set objConnection = New Connection<BR> strConnection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=database.mdb"<BR> objConnection.Open strConnection<BR> <BR> &#039; Remove Existing Database Location<BR> Set objRecordset = New Recordset<BR> strSql = ""<BR> strSql = strSql & "SELECT * "<BR> strSql = strSql & "FROM tblDataBase"<BR> objRecordset.Open strSql, objConnection, adOpenStatic, adLockPessimistic<BR> <BR> <BR> &#039; Add New Database Location<BR> If objRecordset.EOF Then<BR> objRecordset.AddNew<BR> objRecordset.Fields("databaseLocation").Value = mdlGeneral.MassageData(DlgOpenDatabase.FileName)<B R> objRecordset.Update<BR> Else<BR> objRecordset.Fields("databaseLocation").Value = mdlGeneral.MassageData(DlgOpenDatabase.FileName)<B R> objRecordset.Update<BR> End If<BR> <BR> Set objRecordset = Nothing<BR> Set objConnection = Nothing<BR> <BR> ReSetDatabase = True<BR> Exit Function<BR> <BR>ErrHand:<BR> ReSetDatabase = False<BR>End Function<BR><BR><BR><BR>The program is rather a simple one.<BR>Here are the Project References:<BR><BR>- Visual Basic for Applications<BR>- Visual Basic runtime objects and procedures<BR>- Visual Basic objects and procedures<BR>- OLE Automation<BR>- Microsoft ActiveX Data Objects 2.5 Library<BR><BR>I only manually added the last reference.<BR><BR>When the program is run as script in the VB editor(Interdev 6), it runs with no problems.<BR><BR>Any help would be greatly appreciated.<BR><BR>Thanks for your time.<BR>Conrad Smith<BR>

  2. #2
    Join Date
    Dec 1969

    Default Try this...

    Should be <BR><BR>Set objConnection = New ADODB.Connection<BR>Set objRecordset = New ADODB.Recordset<BR><BR>On a side note, you should explicitly close the objects before destroying them<BR><BR>objRecordSet.close<BR> ose<BR>

Posting Permissions

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