J
josephsamuels
Hello,
I have created an application that parses a text file and imports the
data into an access table. It reads each line of the file and stores
the entire line as a string. Then, it parses the string and separates
it into many smaller strings . Each smaller string is then imported
into a field in the database using an Insert query.
Everything had been working great until today.
I have a text file that must have some hidden characters in it or
something, because when i store data that looks like spaces in a
smaller string, the smaller string breaks my insert query.
Here is a basic version of my insert query:
"insert into test ([test]) values ( '" strline "' )"
When I read the text file in question, I get this error:
-Run-time error '3075': Syntax error in string in query expression '".-
I printed the SQL statement to see what was happening, and this is what
the printed SQL looks like: Insert into test ([test]) values ('
This text in question should just be spaces, but when I hover over the
variable in debug mode it shows a string like this:
""
What is going on with this? Is there any way I can convert
"" to just spaces?
A few things I've tried that don't work:
instr(1,strline,"") - to see if the string contained the character
trim(strline) - to see if trimming the string would return spaces
If anyone can help me with this I would be very grateful. Thanks.
I have created an application that parses a text file and imports the
data into an access table. It reads each line of the file and stores
the entire line as a string. Then, it parses the string and separates
it into many smaller strings . Each smaller string is then imported
into a field in the database using an Insert query.
Everything had been working great until today.
I have a text file that must have some hidden characters in it or
something, because when i store data that looks like spaces in a
smaller string, the smaller string breaks my insert query.
Here is a basic version of my insert query:
"insert into test ([test]) values ( '" strline "' )"
When I read the text file in question, I get this error:
-Run-time error '3075': Syntax error in string in query expression '".-
I printed the SQL statement to see what was happening, and this is what
the printed SQL looks like: Insert into test ([test]) values ('
This text in question should just be spaces, but when I hover over the
variable in debug mode it shows a string like this:
""
What is going on with this? Is there any way I can convert
"" to just spaces?
A few things I've tried that don't work:
instr(1,strline,"") - to see if the string contained the character
trim(strline) - to see if trimming the string would return spaces
If anyone can help me with this I would be very grateful. Thanks.