The Export Pound Sign or number sign

K

KWhamill

I have to export the Pound sign or Number sign (#) as a field heading in a
text file. it's actually part of the field heading, as in #Bob. what the
exported file ends up with is .Bob. Does any one know how to make this stop,
I greatly appreciate it
 
R

Roger Carlson

I can think of only two methods, the first is quick and dirty, the second
requires programming.

1) Export a query based on the table, aliasing your field name with some
other character, say ^. Then open the text file in Notepad and search for ^
and replace with #.

2) Create your own export routine. It could be something as simple and
hard-coded as this:

Open "c:\TestOutput.txt" For Output As #1
Set cnn = CurrentProject.Connection
rst.Open "qryExportFormatted", cnn, adOpenForwardOnly, adLockReadOnly
'Print column headings
Print #1, "Field1,Field2,Field3,#Bob,Field5"
rst.MoveFirst
Do While Not rst.EOF
MyString = rst!Field1& "," & _
rst!Field2& "," & _
rst!Field3& "," & _
rst!,#Bob& "," & _
rst!Field5
'print a single record
Print #1, MyString
rst.MoveNext
Loop


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
K

KWhamill

It lookms like Ii'm going with the easy way for now. I need this thing to
work by Friday and I'm having a larger problem. I'm also tring to export some
numbers. I need it exported as 8 decimal places but the exporter is randomly
showing either 2 decimal places or scientific notation. I'm begining to think
that i'm going to need to right this in VBA. any ideas?
 
R

Roger Carlson

Again, export your data from a query where you format the data in the format
that you want it. You might try looking at a sample on my website
(www.rogersaccesslibrary.com) called "ExportFormattedFixed.MDB". This shows
how to export formatted fields to a fixed width text file, but the
formatting things can be used in delimited files as well. Maybe it will
give you some ideas.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
K

KWhamill

This was exactly the right solution. It gave me the foothold i needed to make
eveything work. I used FormatNumber(), and for the other number it was just
better to use CStr(); by formatting it as text it no longer wanted to add the
two decimal places.
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top