Originally posted by joshapalooza
Code:
Private Sub cmdClear_Click() On Error Resume Next Me.cboSort1 = "" Me.cbosort2 = "" Me.cboSort3 = "" Me.cboSort4 = "" cboSort1.SetFocus End Sub
Private Sub close_Click()
On Error GoTo Err_close_Click
DoCmd.close
Exit_close_Click:
Exit Sub
Err_close_Click:
MsgBox Err.Description
Resume Exit_close_Click
End Sub
Private Sub cmdSetSort_Click()
Dim strSQL As String, intCounter As Integer
'Build strSQL String
For intCounter = 1 To 4
If Me("cboSort" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("cboSort" & intCounter) & "]"
If Me("Chk" & intCounter) = True Then
strSQL = strSQL & " DESC"
End If
strSQL = strSQL & ", "
End If
Next
If strSQL <> "" Then
'Strip Last Comma & Space
strSQL = Left(strSQL, (Len(strSQL) - 2))
'Set the OrderBy property
Reports![rptPersonnel].OrderBy = strSQL
Reports![rptPersonnel].OrderByOn = True
Else
Reports![rptPersonnel].OrderByOn = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
' Open the report maximized, in Print Preview
DoCmd.OpenReport "rptPersonnel", acViewPreview
DoCmd.Maximize
End Sub
Private Sub Refresh_Click()
On Error GoTo Err_Refresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Refresh_Click:
Exit Sub
Err_Refresh_Click:
MsgBox Err.Description
Resume Exit_Refresh_Click
End Sub
Private Sub cmdClear_Click() On Error Resume Next Me.cboSort1 = "" Me.cbosort2 = "" Me.cboSort3 = "" Me.cboSort4 = "" cboSort1.SetFocus End Sub
Private Sub close_Click()
On Error GoTo Err_close_Click
DoCmd.close
Exit_close_Click:
Exit Sub
Err_close_Click:
MsgBox Err.Description
Resume Exit_close_Click
End Sub
Private Sub cmdSetSort_Click()
Dim strSQL As String, intCounter As Integer
'Build strSQL String
For intCounter = 1 To 4
If Me("cboSort" & intCounter) <> "" Then
strSQL = strSQL & "[" & Me("cboSort" & intCounter) & "]"
If Me("Chk" & intCounter) = True Then
strSQL = strSQL & " DESC"
End If
strSQL = strSQL & ", "
End If
Next
If strSQL <> "" Then
'Strip Last Comma & Space
strSQL = Left(strSQL, (Len(strSQL) - 2))
'Set the OrderBy property
Reports![rptPersonnel].OrderBy = strSQL
Reports![rptPersonnel].OrderByOn = True
Else
Reports![rptPersonnel].OrderByOn = False
End If
End Sub
Private Sub Form_Open(Cancel As Integer)
' Open the report maximized, in Print Preview
DoCmd.OpenReport "rptPersonnel", acViewPreview
DoCmd.Maximize
End Sub
Private Sub Refresh_Click()
On Error GoTo Err_Refresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_Refresh_Click:
Exit Sub
Err_Refresh_Click:
MsgBox Err.Description
Resume Exit_Refresh_Click
End Sub
Leave a comment: