Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run-time error -2417217900 (8004e14)

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
0
0
US
I am blowing up on run-time error -2417217900 (8004e14).
When I consulted MS Knowledge base it stated the problem is occurring because data control (ADODC1) calls prepend SELECT * FROM to the recordsource value. SO when I code:
Adodc1.RecordSource = "SELECT * From Guradian_A where txtscccc_id= " & skey & ";"
It is like coding SELECT * FROM (SELECT ALL FROM ....). The solutions they gave were: They wanted me to change adcmdtable to another option. Or Use a table name instead of a SQL SELECT statement for the RecordSource property, so that SELECT * FROM Tablename is generated

The only one that seems to make sense is the last one but I don’t know how to code it.

Does anyone have any suggestions.
Thanx
Trudye


Here is the code:
Private Sub cboLookUp_Click()
Dim sText As String
Dim sLenght As Integer
Dim indx As Integer
Dim pos As Integer
Dim sKey As Integer
Dim ck As String
pos = 0

Set adoCombo = New ADODB.Connection
Set adoRec = New ADODB.Recordset

'Do a LookUp in Combo
adoCombo_Open conString
adoRec.Open "[Guardian_A]", adoCombo

'this rtn will give us the length of the key (Scccc_id) and then the actual key
'MsgBox "you clicked item " & (cboLookUp.Text)
sText = cboLookUp.Text
If (Len(sText)) Then
sLenght = (Len(sText))
pos = sLenght
Else
Exit Sub
MsgBox "Invalid Entry contact Program Support"
End If

Do While pos > 0
ck = Mid(sText, pos, 1)
If ck = " " Or IsNull(ck) Then
pos = pos + 1 'beginning of key found back up 1 position
sKey = Mid(sText, pos) 'extract key
Exit Do
Else
pos = pos - 1 'beginning of key not found back up 1 more byte
End If
Loop

Adodc1.RecordSource = "SELECT * From Guardian_A where scccc_id = " & sKey & ";"
Adodc1.Refresh

End Sub
 
OOPS! That's like making a sandwich and forgetting the bread.

err. Description: Syntax errors in FROM clause
Debug line:Adodc1.Refresh

If I remove Adodc1.Refresh I don't get the error but the recordset does not move (ie., the requested record does not display).

Thanks NoCoolHandle for responding
Trudye

OBTW: I know I took the long way around to extract the key (sKey) but it is the correct key.
 
You might want to double check the spelling of your table names.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
One method I use to debug is to create the SQL and place it in a string variable. Then use debug.print to see exactly what the SQL statement is. This also allows me to cut and paste it from the immediate window into a database tool (query analyzer for SQL server) and see what errors I get. I find the errors the database tools throw are more descriptive than ADO errors.

Also you can try assigning that string variabale to the ADO recordsource instead and see what happens.

Thanks and Good Luck!

zemp
 
I have a question. Since this is a combo box selection why am I interrogating my MS Access table "Guradian_A"? Why am I not interrogating the recordset of the Adodc1 (data control)? It seems to me since the recordset has been filled/contains all of the records I should be able to just pull the record from the recordset.

This may not be a smart question but it just seems logical to me. But what the heck to do I know?


Just asking
Trudye
 
I am confused (which is not a revelation). When I use the Immediate Window to display my SQL call (Adodc1.RecordSource = "SELECT * From Guardian_A where scccc_id = " & sKey & ";") the only value that shows in the Immediate Window is "Guardian_A". When I place my cursor on the "Adodc1.Recordsource" portion of the SQL statement I get the entire Select statement. Does Immediate Window not print recordset values?

Having said that my original problem remains. The SQL statement looks good (thru Novice eyes). But it still does not display the requested record.

I checked the table to insure the record I was requesting existed. I double-checked the spelling of the table. The syntax on the SQL statement looks ok. What the heck am I missing?

Any suggestions are appreciated.
Thanx
Trudye
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top