Example

Saving Records to a Text File.


Saving records sub procedure.

The following is a simple example of how to save the selected records in the grid to a text file after showing a Save As dialog box.  The sub procedure assumes you have Common Dialog control named "CD1" and a DGrid control named "DGrid1" sited on the form.


Private Sub ShowSaveAs()
    On Error Resume Next
    Err.Clear
    CD1.Filter = "Text (*.txt)|*.txt"
    CD1.Action = 2
    If Err Then Exit Sub 'user canceled
    DoEvents
    DGrid1.SaveAs CD1.FileName
End Sub