Export field from form

  • Thread starter Thread starter salmanjavaheri
  • Start date Start date
S

salmanjavaheri

Hi, how can i export the contents of an unbound field from a form, to
a text file?

TIA
 
Try something like

Open "C:\FileName.txt" For OutPut As #1
Print #1, Me.[TextBoxName]
Close #1
 
also, is it possible to specify the text to be imported within the
actual vba module? instead of the data coming from a form's field

Ofer Cohen's Original Example:

Open "C:\FileName.txt" For OutPut As #1
Print #1, Me.[TextBoxName]
Close #1


You can also export directly from VBA code instead of a control on a
form.

Dim strYourData As String

strYourData = "Whatever You Want"

Open "C:\FileName.txt" For OutPut As #1
Print #1, strYourData
Close #1


Sincerely,

Chris O.
 
How do i put line breaks in?

also, is it possible to specify the text to be imported within the
actual vba module? instead of the data coming from a form's field

Ofer Cohen's Original Example:

Open "C:\FileName.txt" For OutPut As #1
Print #1, Me.[TextBoxName]
Close #1

You can also export directly from VBA code instead of a control on a
form.

Dim strYourData As String

strYourData = "Whatever You Want"

Open "C:\FileName.txt" For OutPut As #1
Print #1, strYourData
Close #1

Sincerely,

Chris O.
 
Just add another row

Open "C:\FileName.txt" For Output As #1
Print #1, "FirstLine"
Print #1, "Second Line"
Print #1, "Etc"
Close #1

--
Good Luck
BS"D


How do i put line breaks in?

also, is it possible to specify the text to be imported within the
actual vba module? instead of the data coming from a form's field

Ofer Cohen's Original Example:

Open "C:\FileName.txt" For OutPut As #1
Print #1, Me.[TextBoxName]
Close #1

You can also export directly from VBA code instead of a control on a
form.

Dim strYourData As String

strYourData = "Whatever You Want"

Open "C:\FileName.txt" For OutPut As #1
Print #1, strYourData
Close #1

Sincerely,

Chris O.
 
Back
Top