By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,847 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,847 IT Pros & Developers. It's quick & easy.

To have a field name altered

P: n/a
Roy
Hi all,
I have a strange request.A client of mine has a data from text file
which has to be imported and calculations done.This is fine and works
good.But one of the fields is named Dept. with the period.Because of
Access,this (.) period is eliminated while importing.He wants the
period to appear on the field name in the export file.Is this
possible?

Thanks,

Roy

Oct 10 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Roy wrote:
Hi all,
I have a strange request.A client of mine has a data from text file
which has to be imported and calculations done.This is fine and works
good.But one of the fields is named Dept. with the period.Because of
Access,this (.) period is eliminated while importing.He wants the
period to appear on the field name in the export file.Is this
possible?

Thanks,

Roy
If it can't be done via the Export, you can always write out the file
easily enough and do whatever you want.

See Open, Print, Put, Write, Close in help.
Oct 10 '07 #2

P: n/a
Roy
On Oct 10, 2:42 pm, Salad <o...@vinegar.comwrote:
Roy wrote:
Hi all,
I have a strange request.A client of mine has a data from text file
which has to be imported and calculations done.This is fine and works
good.But one of the fields is named Dept. with the period.Because of
Access,this (.) period is eliminated while importing.He wants the
period to appear on the field name in the export file.Is this
possible?
Thanks,
Roy

If it can't be done via the Export, you can always write out the file
easily enough and do whatever you want.

See Open, Print, Put, Write, Close in help.
is it possible to elaborate on this,any example?

Thanks,

Roy

Oct 10 '07 #3

P: n/a
Roy wrote:
On Oct 10, 2:42 pm, Salad <o...@vinegar.comwrote:
>>Roy wrote:
>>>Hi all,
I have a strange request.A client of mine has a data from text file
which has to be imported and calculations done.This is fine and works
good.But one of the fields is named Dept. with the period.Because of
Access,this (.) period is eliminated while importing.He wants the
period to appear on the field name in the export file.Is this
possible?
>>>Thanks,
>>>Roy

If it can't be done via the Export, you can always write out the file
easily enough and do whatever you want.

See Open, Print, Put, Write, Close in help.


is it possible to elaborate on this,any example?

Thanks,

Roy
I don't know if this will create a "true" command delimited file....it
puts quotes around everything. Change the output filename and the
recordset and run a test. In the header/col part you'd check to see if
the name is "Dept" and change it to "Dept."
Sub PrintTest()
Dim strFile As String
Dim rst As Recordset
Dim intFor As Integer
Dim intRst As Integer
Dim strOut As String
Dim Quote As String

Quote = Chr(34)

'Change the output name
strFile = "C:\Junk\Junk.Txt"
Open strFile For Output As #1

'Change to your table name
Set rst = CurrentDb.OpenRecordset("Table1")

'print column headers and first 5 records
For intFor = 0 To 5
strOut = ""
If intFor = 0 Then
'create the header/column name line
For intRst = 0 To rst.Fields.Count - 1
strOut = strOut & Quote & rst(intRst).name & Quote & ","
Next
Else
'create the data lines
For intRst = 0 To rst.Fields.Count - 1
strOut = strOut & _
Quote & rst(intRst).Value & Quote & ","
Next
End If

strOut = Left(strOut, Len(strOut) - 1)
Print #1, strOut

rst.MoveNext
Next

Close #1

rst.Close
Set rst = Nothing
End Sub
Oct 10 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.