Overview of Show All Button

JMichaelM

Registered User.
Local time
Yesterday, 16:27
Joined
Aug 4, 2016
Messages
101
There is a button on the form that displays all the records in the form. I have to provide an overview of what the code does so unsure how to explain it in layman terms so a non-technical person understands it. Can anyone help?

Private Sub ShowAll_cmd_Click()
' Change the forms Record Source query to show all records
' unhide the Print Prieview button

' Objects
Dim oForm As Form ' form
Dim oCtrl As CommandButton ' control
' Strings and things
Dim sSQl As String ' new query for Record Source

On Error GoTo Err_ShowAll_cmd_Click ' establish error handling
Set oForm = Forms![COL Form] ' set form object
' write a new sql statment for the forms Record Source
sSQl = "SELECT * FROM [qryCOLmr] ORDER BY [num];"
oForm.RecordSource = sSQl ' replace the Record Source

' unhide the Print Prieview button
Set oCtrl = oForm![Print_cmd]
oCtrl.Visible = True

Exit_ShowAll_cmd_Click:
Set oCtrl = Nothing ' close object
Set oForm = Nothing ' close object
Exit Sub
 
It's well commented; what don't you understand? It's a somewhat long-winded way of resetting the form's source.
 
Yes I understand but not sure how to explain it to a non-technical person so they understand it.
 
I'd say "changes which records are displayed on the form", changing "records" to orders, products or whatever is being displayed.
 
Thanks and I'll add he Select statement selects the entire source and the Print Cmd button is displayed in the form. 
 

Users who are viewing this thread

Back
Top Bottom