Re: Importing Tales and Columns

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Fri, 25 Jan 2008 16:19:00 -0800, BBAL20 <BBAL20@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

I'm trying to import certain columns within tables via ODBC currently stored
in a SQL enviroment. I'm a beginner when it comes to VB so please forgive me.
I've wrriten the following code to import the table but I only want certain
columns within that table, not the whole table. Suggestions?

Option Compare Database

Private Sub BASE_Click()

Dim SQL_Text As String

DoCmd.TransferDatabase acImport, "ODBC Database", _

"ODBC;DSN=ODS_FDR;APP=Microsoft Office
2003;WSID=PAS-KPATTERS;DATABASE=ODS_FDR;Trusted_Connection=YES;ArrayFetchOn=1;ArrayBufferSize=8", _

acTable , "dbo.BASE", "dbo_BASE" & Format(Date, "mmddyy")

MsgBox "Data transfer to Access is complete.", vbOKOnly, "Status"

End Sub


You'll need to Link to the table (rather than importing it), and then run an
Append query to append only the selected fields into your local table.

Alternatively, create a View on the table selecting only the desired fields
(using SQL/Server's tools) and import that view rather than the table.


John W. Vinson [MVP]
.



Relevant Pages

  • Re: Importing Tales and Columns
    ... user to "link" to the table via an ODBC connection. ... Private Sub BASE_Click ... Append query to append only the selected fields into your local table. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Edit Existing Code
    ... not just Option Compare Database. ... change in the export delim report not the export fixed report. ... Private Sub FindButton_Click ... DoCmd.TransferText acExportDelim,, "qu-Active Cad", ...
    (microsoft.public.access.externaldata)
  • Re: Using a Save button
    ... Option Compare Database ... Private binOK2Save As Boolean ... Private Sub Form_BeforeInsert ...
    (microsoft.public.access.formscoding)
  • Re: Add a new record to a third table
    ... Allen Browne - Microsoft MVP. ... >> Private Sub Form_AfterUpdate ... >> Dim strSql As String ... >> literal value, change it to an Append query, switch to SQL ...
    (microsoft.public.access.formscoding)
  • Re: Using a Save button
    ... Your declaration, and the Form-BeforeInsert and Form_BeforeUpdate events, ... have a variable binOK2Save, but the variable in Save_Click is blnOK2Save. ... Option Compare Database ... Private Sub Form_BeforeInsert ...
    (microsoft.public.access.formscoding)