Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

VBA ODBC Append Query

Question posted by: Starke (Guest) on July 4th, 2008 03:05 AM
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.PRIMPGMCOLLEGE =
'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
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
 
Not the answer you were looking for? Post your question . . .
182,318 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors