-
E_Fail Status Error
Can anyone help me out with an e_Fail status error I am getting. I have been banging my head against the wall all afternoon as to why I am getting this. It should be pretty simple. The user should enter a record id into txtBid and then when a command button is clicked a new recordset should be created and filled with the record from the text box.
Code:
Private Sub Command1_Click()
Dim rsmultiplebids As ADODB.Recordset
Set rsmultiplebids = New ADODB.Recordset
rsmultiplebids.CursorLocation = adUseClient
Dim sqlGetBidData As String
If Not txtBid.Text = "" Then
Call corelink
sqlGetBidData = "Select * from core_dedup where BID = '" & txtBid.Text & "'"
MsgBox sqlGetBidData
rsmultiplebids.Open sqlGetBidData, cnCore, adOpenDynamic, adLockPessimistic, adCmdText
cmdSplit.Enabled = True
rsmultiplebids.MoveFirst
Set DataGrid1.DataSource = rsmultiplebids
DataGrid1.Refresh
Else
MsgBox "Please enter a BID to review", vbInformation, "Error"
End If
End Sub
Public Sub corelink()
Set cnCore = New ADODB.Connection
cnCore.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=xxxx;PORT=3306;DATABASE=core; USER=SCA_Terminal;PASSWORD=kevin;OPTION=3;"
cnCore.Open
End Sub
-
Re: E_Fail Status Error
I tested your code with my connection string and it worked. What line of code is causing the error?
-
Re: E_Fail Status Error
I have a line
Code:
rsmultiplebids.movefirst
In another sub that causes the error. It looks to me like the recordset isn't being filled even though I know that the record ID I am putting in the text box has records in the DB associated with it.
-
Re: E_Fail Status Error
You are creating it at the event level of your button. As such, msmultiplebids does not exist outside of the code in that button click event.
-
Re: E_Fail Status Error
I've had the Dim statment up in the general section and still got the same error. I only put it under the click event to show that I was DIMing it.
-
Re: E_Fail Status Error
I would suggest posting the "exact" code, it will make it easier to find the problem.
-
Re: E_Fail Status Error
Also check the recordset to see if there are records in it.
Code:
rs.open .......
if rs.EOF or rs.BOF then
' no records
end if