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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read in HTML Query Headers 3

Status
Not open for further replies.

Fubear

IS-IT--Management
Sep 11, 2002
299
GB
Ok,

We sent out an HTML email questionaire throughout the office, and our IIS server is currently 'broken' so writing some kind of script to recieve the responses wasn't feasable.

I currently have 15 reposnses in my inbox (I only sent it out about 20 mins ago), with a .ATT file in them. The contents of the file is one simepl line which reads similar to:

Q1=Yes&Q2=No&....

Usually I would write an ASP/PHP script to recieve the responses, and I have a prewritten PHP script that will scan for .ATT files and put them into CSV format so i can import into Access, but right now the server isnt recognising either of those formats.

Is it possible to write a module for an access databse that will scan a directory for all .ATT files, parse them into a readable format, and then insert them into a table?

I dont really know where to start with this one, so any help that will push me in the right direction would be appreciated.
 
Something like:

'get first ATT file
strFile = Dir("C:\Path\*.att")
While strFile<>&quot;&quot;
intFreeFile = FreeFile
'Open the file for I/O
Open &quot;C:\Path\&quot; & strFile For Input As #intFreeFile
While Not EOF(intFreeFile)
'Read each line
LineInput #intFreeFile, strLine
'Do your stuff with the line
Wend
'close the file
Close #intFreeFile
'get next ATT file name
strFile = Dir

Wend

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
This will get you started with at least the string splitting logic for adding to table. Paste procedure below into a module. You can see results by pasting the follwing into command window and pressing enter:

call field_split(&quot;Q1=Yes&Q2=No&quot;)


Sub field_split(psString As String)
' sample call:
' call field_split(&quot;Q1=Yes&Q2=No&quot;)

ReDim aFields(1) As String

aFields = Split(psString, &quot;&&quot;)
Dim iCntr As Integer
Dim sVal As String
Dim sFldName As String
Dim sFldVal As String
For iCntr = 0 To UBound(aFields)
ReDim aVals(1) As String
sVal = aFields(iCntr)
aVals = Split(sVal, &quot;=&quot;)

Debug.Print aVals(0)
Debug.Print aVals(1)
Debug.Print &quot;-----------&quot;
Next iCntr

end sub


As far as reading text files, look into the filesystem object in help, that is most straightfoward was to read files. Good luck.



Mike Pastore

Hats off to (Roy) Harper
 
Cool,

I think you can combine danvlas and my posts to get you 90% to your goal.

Mike Pastore

Hats off to (Roy) Harper
 
Thanks guys.
Sadly the results needed to be correlated this morning, and because of 'techincal problems' I was unable to get online to grab your code.

This time around I wasforced to do it all manually, but im sure this code will come in handy for the future.
 
Fubear,

If you do a lot of on-line surveys, you ought to check out MS Sharepoint services. We implemented it to do some document sharing, but the on-line survey is a great added benefit.

The Sharepoint services (not portal) only costs the price of a copy of Office XP developer with no CALs.

It stores the data in an MSDE on the server so if you ever need to get to the data - it is fairly simple. However, sharpoint correlates the answers for you into graphs and raw numbers.

Just a suggestion for future thought!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top