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

Formatting Exported Data

Status
Not open for further replies.

Gaffi1

Technical User
Apr 23, 2004
70
US
We are trying to automate our employee file for our data collection software via our employee database. We can export the necessary data, but can't seem to get the export formatting down.

The way the data is stored in the original file is:
ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] ID Name SpecialType Mode [] etc etc etc....

It's important to note that the [] is actually a break symbol for the record that I have not figured out how to add.

Second, When I export the data, it comes out as:
ID Name SpecialType Mode
ID Name SpecialType Mode
ID Name SpecialType Mode
ID Name SpecialType Mode
ID Name SpecialType Mode

Does anyone have any simular experience with a problem like this and have any suggestions? Thanks!
 
Gaffi1,

When you get a chance, I think anyone offering a potential solution will probably need a little more information:

What application are you exporting to/from (I assume Access is one of them since you posted here). Also, what OS are you using?

Can you give more realistic examples of your source data (I realize others may understand [blue]ID Name SpecialType Mode [][/blue], but I'm not sure what it means when the same field (?) is repeated nine times and then says "etc...") Is the original data in "paragraph" form with breaks between the data fields?

Finally (again, using more realistic examples), please provide an example of what you'd like the output to look like, including any desired formatting.

I think these things will help get you a better answer faster.

Good luck!
Tim

[blue]_____________________________________________________
If you need immediate assistance, please raise your hand.
If you are outside of Raleigh, raise your hand and say
[/blue] [red]Ooh! Ooh![/red]
 
Thanks Silentaiche for your suggestions. For those interested or familiar with it, the program this file belongs to is called CFMC or Computers for Marketing Corporations, the file is the employee.xxx file.

To start, if I were to take the employee file straight off the server, the data falls into 4 fields:
ID
Name
SpecialType (Special situations an employee has been trained for that the software recognizes to send to them first, notated by numbers for each feature they are trained on, up to 9)
Mode (usually blank except a few accounts that are used for Debugging or Testing and are notated by D or T). I open up the employee.xxx file using notepad, the data would look like this:

Code:
111T George Bush 123 D [] 112T Laura Bush 123456789 DT [] 113T Bill Clinton 456 D [] 114T Hillary Clinton [] 115T Chelsea Clinton []

Like previously mentioned, the [] is actually a vertical rectangle that when pasted in here, makes the next record go to a new line.

The information that fills those 4 fields in the employee.xxx file already resides in our employee resource database, made in Access, and the goal is to automate the creation and maintanance process for the employee.xxx via access instead of CFMC.

Idealy, dumping the data to employee.txt, using VB to change the name to employee.xxx and using code found elsewhere in the forum to ftp the employee.xxx file to its location on the CFMC server, thereby updating it at the push of a button instead of hours worth of putting people in, taking them out, etc on top of this process already being done in the employee resource database.

We know how to change the file name and ftp the data, and we can dump the data into the employee.txt file. However, when we do, it doesn't come out in the same format as listed above, it comes out like below:

Code:
111T George Bush 123 D 
112T Laura Bush 123456789 DT 
113T Bill Clinton 456 D 
114T Hillary Clinton
115T Chelsea Clinton

Thanks to everyone that can help!
 
Gaffi1,

Open a recordset for this table and
Code:
Dim fso As Object
Dim fl As Object

Set fso = CreateObject("Scripting.FileSystemObject")
Set fl = fso.CreateTextFile("C:\Kordela.txt, 8, True)

While Not rst.EOF
   ThisRecord = rst.Fields(0)& " " & _
                rst.Fields(1)& " " & _
                rst.Fields(2)& " "
   If Len(rst.Fields(3))>0 then    
      ThisRecord = ThisRecord & rst.Fields(3)& " []"
   Else
      ThisRecord = ThisRecord & "[]"
   End If
   fl.Write (ThisRecord)
Wend
fl.Close

Set fl = Nothing
Set fso = Nothing
Close the recordset

The file should look like you need
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top