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
adoCombpen 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
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
adoCombpen 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