709-218-7927 The Landfall Garden House 60 Canon Bayley Road CANADA A0C 1B0 |
---|
Snapshot of all Data
From time to time you will want to make a snapshot of an entire record for printout.
Perhaps you are going to visit a prospect and would like to take with you a compressed printout holding the address and telephone number, contact names and a history of previous conversations. In short, everything you know about the prospect.
This will be a modified version of the previous exercise - we will want to dump all the controls to a text file that we can print out.
We will need a Command Button called cmd_SnapShot with a caption "Snapshot".
I would be inclined to code this by hand, rather than by using the Wizard.
Your skeletal code will look like this:
Private Sub cmd_Snapshot_Click() End Sub
We would like to build a string with one line per field.
This string will be very much like the string we exported for deleted data, but instead of using a TAB character (suitable for import into a spreadsheet), we will use a carriage-return line-feed (suitable for import into Word.
Private Sub cmd_Snapshot_Click() Dim strRecord As String strRecord = strFormRecord(Me, vbCrLf) Call strPrintFile("Snapshot.DOC", strRecord) End Sub
It's so easy when you know how!
In the example above I have used a file extent of ".DOC".
Our utility procedure " strPrintFile" will recognize the extent and will not append a ".TXT" extent.
In consequence, although my snapshot file will be truly a text file, and a very small one at that (about 300 characters), I will be able to double-click on the name and launch my word processor, making the data immediately available for printing.
Note too the slight difference in the call to "strPrintFile", where I have used the vbCrLf character as a delimiter instead of the vbTab.
7092187927 CPRGreaves@gmail.com Bonavista, Friday, December 04, 2020 5:51 PM Copyright © 1996-2020 Chris Greaves. All Rights Reserved. |
---|