Save as file

  • Thread starter Thread starter Martin Gustavsson
  • Start date Start date
M

Martin Gustavsson

I want to be able to save data on a form as a file. I have a form with a
standard text and with individual names (from db). I want to be able to save
one file for each person containing that persons name. The filename should
be the same as the person "in" the file.
Is this possible?

Thank's
 
The details would depend on the type of file you want, but the following
example saves a text file, with the contents of each control on a separate
line, in the same folder as the application ...

Private Sub cmdSaveToFile_Click()

Dim intFile As Integer
Dim strFile As String

intFile = FreeFile
strFile = CurrentProject.Path & "\" & Me!txtCustomerName
Open strFile For Output As intFile
Print #intFile, Me!txtContactName
Print #intFile, Me!txtCustomerAddress
Print #intFile, Me!txtPhoneNumber
Close intFile
Shell "notepad.exe " & strFile

End Sub
 
Back
Top