Connecting Tech Pros Worldwide Help | Site Map

VBA ODBC Append Query

  #1  
Old July 4th, 2008, 04:05 AM
Starke
Guest
 
Posts: n/a
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Invalid Argument on Append Query Rich P answers 14 October 11th, 2008 03:15 AM
Exporting a Table to ODBC Database Bob Sanderson answers 9 December 14th, 2007 12:45 AM
Q:Access Parameterized Query to Oracle? totierne answers 0 November 13th, 2005 11:40 AM
query to split fields into multiple rows? bu answers 5 November 13th, 2005 07:38 AM