Results 1 to 3 of 3

Thread: One last question

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    33

    Post

    Preeti-

    I had references to MS ActiveX Data Objects Library and Data Objects Recordset Library. I added all the other references that were remotely connected with ADODB, and unfortunately I am still getting the same error messages. Could it be anything else? Rrrrgh. And on top of this thing, one of my report generator forms has gone screwy; I think it's something wrong with one of my Crystal Reports. Aieeee.

    Anyhow, thanks for your help.

    -Jonathan

  2. #2

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    33

    Post

    First, I'd like to thank Preeti and Serge for their help. I've managed to polish off almost all of the app I'm working on. I do have one last question, though, and I hope someone can help me with it. I'm trying to use the following code to return records matching the search criteria from a database. It isn't working. When I open the query screen in testing, I get a message that says Adodc1 Class not Found. I have no idea what this means. Further, when I try to run a query I get the message "Method Execute of object command failed." I really don't know what I'm doing with the code that tries to alter the command text of the ADO control. Can anyone help? Here's the

    code:Option Explicit
    Dim strTable As String
    Dim strFindBy As String
    Dim strMatchWith As String
    Dim SQL$
    Dim SearchSQL As String

    Private Sub cmdExit_Click()
    Unload Me
    End Sub

    Private Sub cmdSearch_Click()
    strMatchWith = txtMatchWith
    strFindBy = cboFindBy
    FindTable
    SQL$ = "SELECT * FROM " & strTable
    SQL$ = SQL$ & " WHERE " & strFindBy
    SQL$ = SQL$ & " = '" & strMatchWith & "'"
    SearchSQL = SQL$
    Dim Cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset
    Cmd.CommandText = SQL$
    Cmd.CommandType = adCmdText
    Set rs = Cmd.Execute()
    rs.Close
    DataGrid1.Visible = True
    End Sub

    Private Sub FindTable()
    If cmbFindBy = "BarrierType" Then strTable = "Raceway"
    If cmbFindBy = "CableNumber" Then strTable = "Cable"
    If cmbFindBy = "ComponentNumber" Then strTable = "Component"
    If cmbFindBy = "DestinationFrom" Then strTable = "Cable"
    If cmbFindBy = "DestinationTo" Then strTable = "Cable"
    If cmbFindBy = "DeviceNumber" Then strTable = "Device"
    If cmbFindBy = "Division" Then strTable = "FireZone"
    If cmbFindBy = "Drawings" Then strTable = "Raceway"
    If cmbFindBy = "ElectricalDrawings" Then strTable = "Cable"
    If cmbFindBy = "FireArea" Then strTable = "FireArea"
    If cmbFindBy = "FireZone" Then strTable = "FireZone"
    If cmbFindBy = "Location" Then strTable = "Device"
    If cmbFindBy = "PIDLocation" Then strTable = "Component"
    If cmbFindBy = "PIDNumber" Then strTable = "Component"
    If cmbFindBy = "RacewayNumber" Then strTable = "Raceway"
    If cmbFindBy = "RacewayType" Then strTable = "Raceway"
    If cmbFindBy = "SystemNumber" Then strTable = "Component"
    Exit Sub
    End Sub

    Private Sub frmQuery_Unload()
    Adodc1.Refresh
    DataGrid1.Visible = False
    End Sub

    Thanks again,
    Jonathan

  3. #3
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    Check to make sure that you have a reference to Microsoft ActiveX Data Controls. Menu Projects|References.

    If you do not make the reference. That could be the cause of both errors. First you application can not find you ado control and second Execute from the DAO objects expects a source (a SQL Statement) so maybe it is using that version of the Execute method instead of the one you want.

    HTH,

    Preeti

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