Hello guys,
Its a tricky question,hope to get answer ,well my question is ,i have a
table name : refer_lgl_mgr it has
col name : qrynm which holds my query
select atab,btab from s_prod
where atab like 'Asr%'
how can I execute the qrynm column.
if it can be executed I need to insert the value of atab,btab
into table call refer_cv with same col atab and btab.
One thing is that this should happen when user presses the button.the code is shown below which i tried:
----
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
'Dim conn As New ADODB.Connection
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim Rqry As String
conn.Open "conn", "meuser", "jul"
' Fetch qry.
Set rs = conn.Execute("SELECT QRYNM FROM REFER_LGL_MGR")
Dim strsql
If Not rs.EOF Then
rs.MoveFirst
Do While Not rs.EOF
Rqry = rs.Fields(0).Value
MsgBox Rqry
strsql = "Insert into refer_cv " & Rqry
conn.Execute strsql
rs.MoveNext
Loop
End If
rs.Close
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
------
So I get just qry in msgbox ,but not result set so what i am missing let me know,if anyone can help me.
Hope to get answer asap.
Thanks
vsap
Its a tricky question,hope to get answer ,well my question is ,i have a
table name : refer_lgl_mgr it has
col name : qrynm which holds my query
select atab,btab from s_prod
where atab like 'Asr%'
how can I execute the qrynm column.
if it can be executed I need to insert the value of atab,btab
into table call refer_cv with same col atab and btab.
One thing is that this should happen when user presses the button.the code is shown below which i tried:
----
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
'Dim conn As New ADODB.Connection
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim Rqry As String
conn.Open "conn", "meuser", "jul"
' Fetch qry.
Set rs = conn.Execute("SELECT QRYNM FROM REFER_LGL_MGR")
Dim strsql
If Not rs.EOF Then
rs.MoveFirst
Do While Not rs.EOF
Rqry = rs.Fields(0).Value
MsgBox Rqry
strsql = "Insert into refer_cv " & Rqry
conn.Execute strsql
rs.MoveNext
Loop
End If
rs.Close
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err.Description
Resume Exit_Command2_Click
End Sub
------
So I get just qry in msgbox ,but not result set so what i am missing let me know,if anyone can help me.
Hope to get answer asap.
Thanks
vsap