Create Import Spec Programmatically

Vassago

Former Staff Turned AWF Retiree
Local time
Today, 15:23
Joined
Dec 26, 2002
Messages
4,748
Hello all,

Is there a way to create an import specification automatically, such as via vba? I'm trying to create a form that will allow a user to import a list of fields that could appear on a table. This field can change though depending on what kind of list they are trying to import. Does anyone know a way?

Thanks!

Vassago
 
Thanks for the reply, however, it's not really what I am looking for. That's not really what I am looking for. I am trying to create the spec itself using VBA, I know how to reference the spec after it's created with VBA.

Does anyone know if there is a way to accomplish this?
 
As far as I know there is no way you can create import specifications by writing your own code.
That's not a problem as you don't need to.
Create an import specification for the table(s) involved as per standard Access features.
Now what you need to do in VBA it to check upon all columns selected by the user for import.
If a column is NOT selected, simply insert null for each record that will be inserted.

Shouldn't be too difficult , f.i., by skipping through the TableDef to check whether the column has been selected or not.

RV
 
The list they will need to import is a text file, so it won't have the exact same number of characters or fields every time. How would I make it work that way?

There has to be a way to make this work. Anyone else have any ideas?

Vassago
 
Vassago, you can define your own schema.ini . Put the schema.ini in the same directory where the import/export takes place.

There is VBA code to convert import/export specifications to schema.ini, all you need to do is typing schema.ini and import/export specifications in the ms knowledgebase

http://support.microsoft.com/default.aspx?scid=kb;en-us;155512

Use the link to see the code to export your specification to schema.ini
 
giovi2002 said:
Vassago, you can define your own schema.ini . Put the schema.ini in the same directory where the import/export takes place.

There is VBA code to convert import/export specifications to schema.ini, all you need to do is typing schema.ini and import/export specifications in the ms knowledgebase

http://support.microsoft.com/default.aspx?scid=kb;en-us;155512

Use the link to see the code to export your specification to schema.ini

Awesome! I researched the schema.ini capabilities, and thanks to you, I was able to programmatically create my import spec be writing it to a text file, then import the text file using that spec. I truly appreciate your help!
 
I've used this to create my Schema.ini file, but now when I enter it into the SpecificationName of the TrasferText Method, it's telling me that it doesn't exist.
Anyone else have this problem? Any ideas how to fix it?
I tried putting the path, or just the file name, neither worked.

Thanks.

ps. also, everyone seems to be talking about an 'export text wizard' but I can't seem to find it. I don't know how I'm overlooking it, but if someone could point out how to start it, I'd much appreciate it.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom