The data is brought in from a SQL server stored procedure through an ODBC connection (!).
I need to refresh the data but I'm not sure how. It doesn't seem to do anything at present:
I need to refresh the data but I'm not sure how. It doesn't seem to do anything at present:
Code:
Private Sub optGroup_SortOrder_AfterUpdate()
On Error GoTo LocalHandler
Dim optValue As Integer
Dim db As Database
Dim myquery As querydef
Set db = CurrentDb()
Set myquery = db.CreateQueryDef("")
myquery.Connect = connection
optValue = optGroup_SortOrder.Value
'MsgBox (optValue)
If IsLoaded("frmOutstandingTasks") Then
varcc = Forms!frmOutstandingTasks!tempcc
Else
varcc = Forms!frmAdminScreen!tempccname
End If
If optValue = 1 Then
'sort by account code
ElseIf optValue = 2 Then
If varcc = "All Controllers" Then
myquery.SQL = "exec ccapp_LedgerAllInvoiceOrder 0, 2" 'runs the stored proc '0 for the paid flag
myquery.ReturnsRecords = True
Set rs = myquery.OpenRecordset()
'Set Me.Recordset = rs
Set Forms!frmSubLedgerFull.Recordset = rs
Else
myquery.SQL = "exec ccapp_LedgerByControllerInvoiceOrder 0, '" & varcc & "', 2" 'runs the stored proc
myquery.ReturnsRecords = True
Set rs = myquery.OpenRecordset()
'Set Me.Recordset = rs
Forms!frmSubLedgerFull.Requery
Set Forms!frmSubLedgerFull.Recordset = rs
Forms!frmSubLedgerFull.Requery
End If
ElseIf optValue = 3 Then
ElseIf optValue = 4 Then
ElseIf optValue = 5 Then
End If
Exit Sub
LocalHandler:
MessageBox.Show (Err.Description)
End Sub