Question : add  " to export data

I have made some code to create a (manual ) csv file, works fine but now i need to asign an  " befor and after certain fields.


strtext1 = rs!Grootboekrekening.Value & ";" & rs!bedrag.Value & ";" & rs!omschrijvingaantal.Value & ";" & rs!omschrijving.Value & ";" & rs!Dagboek.Value & ";" & rs!Stuknummer.Value & ";" & rs!boekingsperiode.Value

for instance the rs!omschrijving, shows
Tekst  but most be "Tekst"
im not that good with this '"& stuff ;-)))
 
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
Dim strtext1
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT * FROM jnptemp ;", dbOpenSnapshot)
  rs.MoveLast
  rs.MoveFirst
 
    Open bestandsnaam For Output As #1
    If rs.RecordCount > 0 Then
    rs.MoveFirst
    Do Until rs.EOF
    strtext1 = rs!Grootboekrekening.Value & ";" & rs!bedrag.Value & ";" & rs!omschrijvingaantal.Value & ";" & rs!omschrijving.Value & ";" & rs!Dagboek.Value & ";" & rs!Stuknummer.Value & ";" & rs!boekingsperiode.Value
       rs.MoveNext
        Print #1, strtext1      'vult het bestand met data
        strtext1 = ""           'parameter resetten
    Loop
    Else
    
    MsgBox "Er is geen data om te exporteren !!! ", vbInformation
End If
Set rs = Nothing
Close #1

Answer : add  " to export data

Use Chr(34) for the ", e.g.

strtext1 = rs!Grootboekrekening.Value & ";" & rs!bedrag.Value & ";" & rs!omschrijvingaantal.Value & ";" &  Chr(34) & rs!omschrijving.Value &  Chr(34) & ";" & rs!Dagboek.Value & ";" & rs!Stuknummer.Value & ";" & rs!boekingsperiode.Value
Random Solutions  
 
programming4us programming4us