Using generated table class code

The following code shows how generated table class code is used to work with data from a parameters table without being aware that the persistent data of the class are store in a table.

Sub UploadFileNow()
'upload once a day
Dim sngtn As Singleton
Static UploadNeeded As Variant
    If IsEmpty(UploadNeeded) Then
        Set sngtn = New Singleton 'instantiates the class that was generated from the table
        With sngtn
            .FindFirst 'moves to the first (and only) record
            If DateDiff("d", .UploadWeb, Date) > 0 Then 'gets the value of UploadWeb
                UploadNeeded = True
                UploadFile 'Upload the file
                .UploadWeb = Date
                .Update 'saves the changed value
            Else
                UploadNeeded = False
            End If
        End With
    
        Set sngtn = Nothing
    End If
End Sub