Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub Form_Load()
Dim cmd As ADODB.Command
Dim intCount As Integer
Dim rst As ADODB.Recordset
On Error GoTo err_FormLoad
Set cmd = New ADODB.Command
CheckConnect ' Check to see if the gcnn is connected or has timed out, reconnect if closed...
gcnn.CursorLocation = adUseClient
With cmd
.ActiveConnection = gcnn ' use global ADODB connection object
.CommandType = adCmdStoredProc
.CommandText = "my_sp_name"
.Parameters.Refresh
.Parameters("@username") = gstrUser ' global login ID from login screen
.Parameters("@acyrcode") = CURRENT_ACADEMIC_YEAR ' value from constant
Set rst = .Execute ' Run the SP
End With
Set Me.Form.Recordset = rst ' now set the form recordset to the results of the code
' Set the column widths to an appropriate value
' Need one control on the form with a name for each field
' Fields in the recordset that don't exist on the form
' generate an error 438 (property not found)
' If this falls over, its in this loop somewhere...
For intCount = 0 To Me.Form.Recordset.Fields.Count - 1
Me.Controls(rst.Fields(intCount).Name).ControlSource = Me.Form.Recordset.Fields(intCount).Name
Next
Exit Sub
err_FormLoad:
MsgBox Err.Number & " " & Err.Description
Resume Next
End Sub