Answer the question
In order to leave comments, you need to log in
How to set the data type when importing from EXCEL using VBA Access?
In Access, I'm making a function that will import an excel file into a database. Now I use the following algorithm:
1) Direct query to the excel file and saving the results to the access table
2) From this table, I update the table I need with a query
In the process, a problem arose: there are fields where text data, the length of which can be from 0 to 1000 characters. And access recognizes these fields as text and trims them to 255 characters.
If you import a file with a regular function, you can set your own data type for each field, and then the data is not lost. Can this be done in VBA? If possible, how?
Answer the question
In order to leave comments, you need to log in
There is no way to see your method, but it may push you in the right direction, so that the text is not cut off, the field in which you need to insert text exceeding the length of 255 must be of the MEMO type
Yes, I know, I tried to make a request to add to a table with fields of this type already set. But the cut still happens. The only way to import is to do it manually and set the memo type during the import process.
As a result, I had to remove the beautiful import by button. And make a patch: import manually, and then the macro updates the data =(
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question