Connecting Tech Pros Worldwide Help | Site Map

VBA ODBC Append Query

Starke
Guest
 
Posts: n/a
#1: Jul 4 '08
I have the below code, and i need to append the results to a local
table called "tblUserInfo" . The local table, tblUserInfo has the
same data structure as the results. But not sure how to append the
results to that table. Here is my code.


Private Sub cmdFetch_Click()


''' Setup DB connection
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset

Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset


''' Clean up user input
strBiuser = Trim(Me.txtBIQryUserName)
strBiPass = Trim(Me.txtBiQryPassword)

'''Setup Connection to BI-Qry
cnn.Open "PANSY1", strBiuser, strBiPass
rst.ActiveConnection = cnn
rst.CursorLocation = adUseServer


'''Set Query for BI-Qry
rst.Source = "select SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY.STUDENTID,
SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY.LASTNAME, " _
& "SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY.FIRSTNAME,
SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY.USERNAME " _
& "from SEAM_VIEWS_LSA.SEAM_STUDENTTERM,
SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY where " _
& "((SEAM_VIEWS_LSA.SEAM_STUDENTTERM.PRIMPGMCOLL EGE =
'22') and (SEAM_VIEWS_LSA.SEAM_STUDENTTERM.TERM = '08U')) " _
& "and SEAM_VIEWS_LSA.SEAM_STUDENTTERM.STUDENTID =
SEAM_VIEWS_LSA.SEAM_STUDENTPRIMARY.STUDENTID ;"



rst.Open
rst.Close

Set rst = Nothing
Set cnn = Nothing
End Sub
Closed Thread