Exporting to a text file

I am exporting records to a text file.  I need it seperated by comma's and I need all fields in quotes.  I can get the comma's but it doest write it with quotes.  Below is the code I am using.  Please help to get the quotes around the data.  I need in a hurry so I am offering 500pts.

thanks

Public Function WriteDetailFile(mGLAcct As String, mGLAmt As String, mPropertyID As String, mgldate As String, FileName As String)

    Dim filenumber As Integer
  '  Dim FileName As String
    Dim mRecordLine As String
    Dim mDetailLine As String
    Dim F1 As String
    Dim F3 As String
    F1 = "The Apartment Gallery "
    F2 = "Febuary 2006 Transaction Summary"
   
    On Error GoTo Problem
   
    mRecordLine = F1 & "," & mgldate & "," & F2 & "," & mGLAcct & "," & mGLAmt
    'mDetailLine = "Descrip1" & "," & "Date" & "," & "descrip2" & "," & "GLAcct" & "," & "GLAmt"
   
    'FileName = "F:\APPS\GPSTRANSFERS\GPS" & mCompany & mPeriod & "D.TXT"
    filenumber = FreeFile
    If (FileExists(FileName)) Then   'Append
      Open FileName For Append As #filenumber
      Print #filenumber, mRecordLine
      Close #filenumber
    Else   'Write to file
      filenumber = FreeFile
      Open FileName For Output As #filenumber
     ' Print #filenumber, mDetailLine
      Print #filenumber, mRecordLine
      Close #filenumber
    End If
   
   
    Exit Function

Problem:
    MsgBox "Problem writing Detail File" & vbCrLf & Err.Description
    Resume

End Function

Private Function ConvertNumber(m As Integer) As String
    If Len(Trim(m)) = 1 Then
        ConvertNumber = "0" + (LTrim(m))
    Else
        ConvertNumber = m
    End If
   

End Function
mgmhicksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimbobmcgeeCommented:
Specify a doublequote in your assignment by repeating it:

    mRecordLine = """" & F1 & """,""" & mgldate & """,""" & F2 & """,""" & mGLAcct & """,""" & mGLAmt

HTH

J.
jimbobmcgeeCommented:
I mean:

    mRecordLine = """" & F1 & """,""" & mgldate & """,""" & F2 & """,""" & mGLAcct & """,""" & mGLAm & """"

J.
CubeRootCommented:
A clean way to get the quotes is to use the Chr command.

Example:

sString = Chr(34) & "This should do it" & Chr(34)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.