Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import Specification and split DB's issue 1

Status
Not open for further replies.

jean2002

Technical User
May 1, 2003
75
DE
Hi,

I have a database that is split into a front-end and back-end. I have also created a Import Specification (with the Import Wizard) on the back-end.

Now, I have a form that uses code to import data from a file into a table on the back-end. This code uses the Import Specification on the back-end. Is there a way of creating an Import Specification on the front-end, so that I can use this specification on a front-end form rather?

This is what I am trying to do: I want to create an Import Specification on the front-end using the Import Wizard. I specify the import specification details in "Advanced.." of the Wizard. Then in Step 3 of Import Wizard the linked tables do not appear under the drop-down list of "Import to existing table".

Can I simplify this in anyway by importing data to the table on the back-end?

Also, Microsoft speaks of setting up a schema.ini file to detail the import specification. How do I do this?

Thanks for any advice!

Regards,

Jean
 
you can use this function I wrote, it imports a table to a remote DB using automation :

Function ImportTextFile(ByVal strSrc As String, ByVal strDest As String, ByVal strSpecs, strTable) As Integer
' Imports a text file to a remote database
' strSrc = text file to import (delimited)
' strdest = access database name
' strSpecs = Import Specifications
' strTable = Name of destination Access Table
On Error GoTo HandleError
Dim appAccess As Access.Application

Set appAccess = New Access.Application
With appAccess
.OpenCurrentDatabase strDest
.DoCmd.TransferText acImportDelim, strSpecs, strTable, strSrc
.CloseCurrentDatabase
End With
ImportTextFile = 1

ExitHere:
On Error Resume Next
appAccess.CloseCurrentDatabase
Set appAccess = Nothing
Exit Function

HandleError:
If Err.Number = 3625 Then 'import specs doesn't exist
ImportTextFile = 0
Else
ImportTextFile = -1
End If
WriteLogfile strSrc & " - " & Err.Number & " " & Err.Description, strLogPath
Resume ExitHere
End Function
 
Hi thanks for the response.

Looking a few times at this code was worth it. I now understand how to use the
Code:
.OpenCurrentDatabase
method, which allowed me to find a solution. Thanks for your effort!

I managed to create the Import specification on the front-end, which I can now use when calling
Code:
TransferText
on a form on the front-end.

Works like a dream now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top