I am creating a function that writes a String to an external text file. Using some code fragments I found online, I was able to create this:
Function writer(outputMessage As String)
Dim strFile As String
strFile = CurrentProject.Path & "/Output.txt"
Open strFile For Append As 1
Write #1, outputMessage
Close #1
End Function
It works but there is room for improvement. Here are my questions for you:
a) What are the full names for the functions "Write" and "Close"? I tried "application.write" and "file.write" and "docmd.write"....none of them worked.
b) What is the signature for the Write and Close functions? I want know about optional agruments.
c) I recognize that the integer 1 somehow identifies the file. That syntax seems weird and counter-intuitive to me. Are there alternatives to that?
Function writer(outputMessage As String)
Dim strFile As String
strFile = CurrentProject.Path & "/Output.txt"
Open strFile For Append As 1
Write #1, outputMessage
Close #1
End Function
It works but there is room for improvement. Here are my questions for you:
a) What are the full names for the functions "Write" and "Close"? I tried "application.write" and "file.write" and "docmd.write"....none of them worked.
b) What is the signature for the Write and Close functions? I want know about optional agruments.
c) I recognize that the integer 1 somehow identifies the file. That syntax seems weird and counter-intuitive to me. Are there alternatives to that?