PC Review


Reply
Thread Tools Rate Thread

ASCII Again...

 
 
=?Utf-8?B?Qm9iIEJhcm5lcw==?=
Guest
Posts: n/a
 
      1st Sep 2006
I open a CSV, but when I run...

iNumOne = FreeFile
Open "C:\CEFiles\" & cboFileCE For Input As iNumOne
Set Z = CurrentDb
Set RS = Z.OpenRecordset("FromCE")
Do Until EOF(iNumOne)
Input #iNumOne, vStore, vVarZ, vLastInsp, vOneVar, VQues, vTheQues, vAns, _
vComment, vSC, vCD, vCact, vOReason
......
It brings in one long string beginning, and ending with, double-quotes.

What am I doing wrong?

TIA - Bob
 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      1st Sep 2006
Don't know, but I'd debug by doing something like:

Input #iNumOne, vStore, vVarZ
Debug.Print #iNumOne

and adding a variable or 2 after each run.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Bob Barnes" <(E-Mail Removed)> wrote in message
news:B38750FA-AB9A-4A4D-A67D-(E-Mail Removed)...
>I open a CSV, but when I run...
>
> iNumOne = FreeFile
> Open "C:\CEFiles\" & cboFileCE For Input As iNumOne
> Set Z = CurrentDb
> Set RS = Z.OpenRecordset("FromCE")
> Do Until EOF(iNumOne)
> Input #iNumOne, vStore, vVarZ, vLastInsp, vOneVar, VQues, vTheQues, vAns,
> _
> vComment, vSC, vCD, vCact, vOReason
> .....
> It brings in one long string beginning, and ending with, double-quotes.
>
> What am I doing wrong?
>
> TIA - Bob



 
Reply With Quote
 
=?Utf-8?B?Qm9iIEJhcm5lcw==?=
Guest
Posts: n/a
 
      1st Sep 2006
Arvin...

Still bringing the entire row in as a string...

Thank you - Bob

"Arvin Meyer [MVP]" wrote:

> Don't know, but I'd debug by doing something like:
>
> Input #iNumOne, vStore, vVarZ
> Debug.Print #iNumOne
>
> and adding a variable or 2 after each run.
> --
> Arvin Meyer, MCP, MVP
> Free MS-Access downloads:
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
> "Bob Barnes" <(E-Mail Removed)> wrote in message
> news:B38750FA-AB9A-4A4D-A67D-(E-Mail Removed)...
> >I open a CSV, but when I run...
> >
> > iNumOne = FreeFile
> > Open "C:\CEFiles\" & cboFileCE For Input As iNumOne
> > Set Z = CurrentDb
> > Set RS = Z.OpenRecordset("FromCE")
> > Do Until EOF(iNumOne)
> > Input #iNumOne, vStore, vVarZ, vLastInsp, vOneVar, VQues, vTheQues, vAns,
> > _
> > vComment, vSC, vCD, vCact, vOReason
> > .....
> > It brings in one long string beginning, and ending with, double-quotes.
> >
> > What am I doing wrong?
> >
> > TIA - Bob

>
>
>

 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      1st Sep 2006
Using only 2 of the variables brings in the entire string? What about 1 of
them? Seems to me that the separator may be at fault. Also, you may have a
Unix ascii file which omits the carriage return Chr(13) from each row.
--
Arvin Meyer, MCP, MVP
Free MS-Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Bob Barnes" <(E-Mail Removed)> wrote in message
news:548AA0C3-DA32-4384-83A5-(E-Mail Removed)...
> Arvin...
>
> Still bringing the entire row in as a string...
>
> Thank you - Bob
>
> "Arvin Meyer [MVP]" wrote:
>
>> Don't know, but I'd debug by doing something like:
>>
>> Input #iNumOne, vStore, vVarZ
>> Debug.Print #iNumOne
>>
>> and adding a variable or 2 after each run.
>> --
>> Arvin Meyer, MCP, MVP
>> Free MS-Access downloads:
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>> "Bob Barnes" <(E-Mail Removed)> wrote in message
>> news:B38750FA-AB9A-4A4D-A67D-(E-Mail Removed)...
>> >I open a CSV, but when I run...
>> >
>> > iNumOne = FreeFile
>> > Open "C:\CEFiles\" & cboFileCE For Input As iNumOne
>> > Set Z = CurrentDb
>> > Set RS = Z.OpenRecordset("FromCE")
>> > Do Until EOF(iNumOne)
>> > Input #iNumOne, vStore, vVarZ, vLastInsp, vOneVar, VQues, vTheQues,
>> > vAns,
>> > _
>> > vComment, vSC, vCD, vCact, vOReason
>> > .....
>> > It brings in one long string beginning, and ending with, double-quotes.
>> >
>> > What am I doing wrong?
>> >
>> > TIA - Bob

>>
>>
>>



 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      1st Sep 2006
"Bob Barnes" <(E-Mail Removed)> wrote in message
news:548AA0C3-DA32-4384-83A5-(E-Mail Removed)...
> Arvin...
>
> Still bringing the entire row in as a string...


If you are able to use input#, then the data must be CORRECTLY formatted.
That means your data must be separated by comma, and also in most cases the
text data must be CORRECTLY formatted, and that assumes the text parts are
surrounded with a set of quotes.

However, since you data MUST BE correctly formatted to use input, then why
not use the built in import feature of ms-cess?

You might want to paste the first 2, or 3 lines of what the data looks like,
but you going to have ZERO LUCK using input# if you can't get the standard
import to work in the first place....

Somewhere along the way, you taken the wrong curve, since the input#
requites that your data is already in a format that is importable.

So, this begs the question...why not manually import, setup/save the import
spec, and then use transfertext?

I suppose it needs pointing out that if you can't get transfertext to work,
then your input# is NOT going to work.

However, if you can not use the built in import features, then you may very
well have to resort to rolling your own import code, and that being the
case, you will need to use
line input#, and NOT use input#

line input# will pull in a WHOLE line into one variable, and then you must
write your own code to parse out the data....

So, lets clear up why we are not using the built in import, and if not..then
I can't see how the input# is going to work, as it requites the data to
already be in a importable format...


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)


 
Reply With Quote
 
=?Utf-8?B?Qm9iIEJhcm5lcw==?=
Guest
Posts: n/a
 
      1st Sep 2006
Albert...I think this it the proble...

Visual CE makes an "Export" ASCII file like...
050234,"050234",2006-08-24 00:00:00,2006-08-24 00:00:00,"154"....

So using "Input"...I get 050234, (notice Visual CE does NOT put " " around
the first 050234 which is a text...it's treating it like a number.

Then the 2006-08-24 00:00:00,2006-08-24 00:00:00 is brought in with "
preceing it & at the end of the string.

I may have to use line input#...

I'm not sure how to handle this....back to testing an ImportSpec & the Wizard.

Thank you - Bob

"Albert D. Kallal" wrote:

> "Bob Barnes" <(E-Mail Removed)> wrote in message
> news:548AA0C3-DA32-4384-83A5-(E-Mail Removed)...
> > Arvin...
> >
> > Still bringing the entire row in as a string...

>
> If you are able to use input#, then the data must be CORRECTLY formatted.
> That means your data must be separated by comma, and also in most cases the
> text data must be CORRECTLY formatted, and that assumes the text parts are
> surrounded with a set of quotes.
>
> However, since you data MUST BE correctly formatted to use input, then why
> not use the built in import feature of ms-cess?
>
> You might want to paste the first 2, or 3 lines of what the data looks like,
> but you going to have ZERO LUCK using input# if you can't get the standard
> import to work in the first place....
>
> Somewhere along the way, you taken the wrong curve, since the input#
> requites that your data is already in a format that is importable.
>
> So, this begs the question...why not manually import, setup/save the import
> spec, and then use transfertext?
>
> I suppose it needs pointing out that if you can't get transfertext to work,
> then your input# is NOT going to work.
>
> However, if you can not use the built in import features, then you may very
> well have to resort to rolling your own import code, and that being the
> case, you will need to use
> line input#, and NOT use input#
>
> line input# will pull in a WHOLE line into one variable, and then you must
> write your own code to parse out the data....
>
> So, lets clear up why we are not using the built in import, and if not..then
> I can't see how the input# is going to work, as it requites the data to
> already be in a importable format...
>
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
>
>
>

 
Reply With Quote
 
=?Utf-8?B?Qm9iIEJhcm5lcw==?=
Guest
Posts: n/a
 
      1st Sep 2006
Here's an entire row...

050234,"050234",2006-08-24 00:00:00,2006-08-24 00:00:00,"154","Is the center
maintaining copies of all hotwork permits issued for the site for a period of
one year?","If a hotwork permit is issued for a facility, that facility is
required to maintain both the pink and yellow copies of the permit in their
Compliance Manual for a period of one (1) year.","CTOA","Other",2006-08-29
00:00:00,2006-08-30 00:00:00,"hot work permit found",""

If you have a chance...see if you can Import this...either by Wizard or
code...


"Albert D. Kallal" wrote:

> "Bob Barnes" <(E-Mail Removed)> wrote in message
> news:548AA0C3-DA32-4384-83A5-(E-Mail Removed)...
> > Arvin...
> >
> > Still bringing the entire row in as a string...

>
> If you are able to use input#, then the data must be CORRECTLY formatted.
> That means your data must be separated by comma, and also in most cases the
> text data must be CORRECTLY formatted, and that assumes the text parts are
> surrounded with a set of quotes.
>
> However, since you data MUST BE correctly formatted to use input, then why
> not use the built in import feature of ms-cess?
>
> You might want to paste the first 2, or 3 lines of what the data looks like,
> but you going to have ZERO LUCK using input# if you can't get the standard
> import to work in the first place....
>
> Somewhere along the way, you taken the wrong curve, since the input#
> requites that your data is already in a format that is importable.
>
> So, this begs the question...why not manually import, setup/save the import
> spec, and then use transfertext?
>
> I suppose it needs pointing out that if you can't get transfertext to work,
> then your input# is NOT going to work.
>
> However, if you can not use the built in import features, then you may very
> well have to resort to rolling your own import code, and that being the
> case, you will need to use
> line input#, and NOT use input#
>
> line input# will pull in a WHOLE line into one variable, and then you must
> write your own code to parse out the data....
>
> So, lets clear up why we are not using the built in import, and if not..then
> I can't see how the input# is going to work, as it requites the data to
> already be in a importable format...
>
>
> --
> Albert D. Kallal (Access MVP)
> Edmonton, Alberta Canada
> (E-Mail Removed)
>
>
>

 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      1st Sep 2006
ah..yes, this thread.....

Yes, I was able to import that data...the text file I had was:

Store,@var(1),LastInsp,@var(0),Question,TheQues,Guidance,Answer,Comment,SchCorr,CorrDate,CActions,OtherReason

050234,"050234",2006-08-24 00:00:00,2006-08-24 00:00:00,"154","Is the
service center maintaining copies of all Ashland hotwork permits issued for
the site for a period of one year?","Guidance: If a hotwork permit is
issued for a facility, that facility is required to maintain both the pink
and yellow copies of the permit in their Responsible Care Compliance Manual
for a period of one (1) year.","CTOA","Other",2006-08-29
00:00:00,2006-08-3000:00:00,"hot work permit found",""


I have on purpose put a blank line in the above for ease of reading....


However, if I cut and paste the above into a notepad file, then the above
does import just fine.


So, first, lets assume the file name called

test.csv

fire up ms-access.

Now, go file->get external data
select from the dorop down combo, the

text files (*.txt;*.csv;*.tab;*.asc).

Ok, now browse to our file. (note again, I AM ASSUMING A .CSV FILE
EXTENSION....this is IMPORTANT!!!!).

ok, the text import wizard now comes up. It should make a guess, and default
to
* - delimited - Characters such as comma or tab separate each field

click next...

Now, look carefull on this screen....

For the delimiter, choose the comma (it should be selected for you anyway),
and then choose for text qualifier in the combo box choose the double
Quote -- don't foget this...it is impoart, else your long text with commas
in it will NOT work. So, you MUST set the text quaiflier here in that comb
box to "

Also CLICK THE - first row contians field names box!!!!

now, hit next

we are given the choice to create a new table, or existing...lets put it
into a new table for the time being...

so, ok hit next again,

This screen is IMPORTANT, snce we will now setup the data types for each
collum. You
note how "store" is set to a long data type, lets leave that

@var(1) is a really crappy field name, so, change that field name to somting
better. You can do this for all of the @var() guys.

Further Also MAKE SURE YOU change the date/time types to text types. (they
fail during my test import..so, we will fix them later...just import them as
text...do NOT use date/time here).

You are actually better to hit the advanced tab at this point, as you can
MORE easier edit/change the field names. Make sure you change the date/time
field types to text...

And, don't forget to save this spec, as it can be a lot of work to change
all those things above. (note the save as in advanced button)

So, now run the import, you will have your data in a new table, and you also
will have changed those messy field names to something better. At this
point, we could write a append query to send the data to another existing
table, and also take care of the date/time conversion (if you need them in
date/time format).

the above test data imported without ANY ERRORS!!. That means a table import
error did NOT occur when I did this for the above sample data.

Once you have the data in the temp table, you can really do what you want
with it, and furhter process the formats to how you want.....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASCII Help mattc66 via AccessMonster.com Microsoft Access Queries 3 18th Oct 2006 06:32 AM
how to convert non-ISO extended-ASCII to ISO ascii dotNeter Microsoft Dot NET 1 29th Jun 2006 06:53 PM
How can I convert high ASCII to low ASCII Friso Wiskerke Microsoft VB .NET 6 7th Jan 2005 05:52 PM
DOS ASCII Code vs Windows ASCII Code??? Daniel Olivares Microsoft Windows 2000 Developer 0 6th Apr 2004 11:02 PM
Re: ASCII Low Values (Ascii 0) to a string Manfred Suttorp Microsoft Dot NET Framework 2 25th Jul 2003 02:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:05 AM.