Advertisement
Advertisement
| 07.30.2008 at 02:21PM PDT, ID: 23609087 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: |
'----------------Form_frmTasks(Code)
Option Compare Database
Private Sub cmdAdd_Click()
Dim strSQL As String
Dim theTask As String, isActive As Boolean
Dim dActivationDate As Date
dActivationDate = Now()
theTask = Me.txtText
isActive = True
'deactivate previously active record
Set rs = CurrentDb.OpenRecordset("Select * from tblTasks where tblTasks.Active = True")
If rs.RecordCount > 0 Then
appendTblTasksLog rs("Task"), Not rs("Active"), dActivationDate
End If
deactivatePreviousTask Now()
strSQL = "INSERT INTO tblTasks (Task,Active,ActivationDate) VALUES ('" & Me.txtText & "'" & "," & True & ",#" & dActivationDate & "#)"
CurrentDb.Execute strSQL, dbFailOnError
cmdClear_Click
appendTblTasksLog theTask, isActive, dActivationDate
Me.Requery
Me!sfTasks.Requery
Me!sfCompletedTasks.Requery
End Sub
Private Sub cmdClear_Click()
Me.txtText = Null
End Sub
Private Sub Form_Open(Cancel As Integer)
completeClicked = False
activeClicked = False
editClicked = False
taskClicked = False
With Me.sfCompletedTasks.Form
.AllowAdditions = False
.RecordSource = "Select * from tblTasks where Complete=True order by ActivationDate desc"
Set .OtherSubForm = Me.sfTasks.Form
End With
With Me.sfTasks.Form
.RecordSource = "select A.Complete,A.Task,A.Active,A.ActivationDate from (Select top 6 * from tblTasks where Complete=False Order By Active, ActivationDate Asc) As A Order by A.Active Asc, A.ActivationDate Asc"
Set .OtherSubForm = Me.sfCompletedTasks.Form
End With
End Sub
Private Sub txtText_AfterUpdate()
cmdAdd_Click
Me.Requery
Me!sfTasks.Requery
Me!sfCompletedTasks.Requery
Me!sfTasks.SetFocus
Me.txtText.SetFocus 'Add this line to return focus back to txtText
End Sub
'-----------------Form_frmTasksSub(Code)
Option Compare Database
Option Explicit
Public OtherSubForm As Form
Public completeClicked As Boolean, activeClicked As Boolean
Public editClicked As Boolean, taskClicked As Boolean
Private Sub Active_AfterUpdate()
activeClicked = True
completeClicked = False
Me.Requery
OtherSubForm.Requery
Form_frmTasks.sfTasks.SetFocus
End Sub
Private Sub Complete_AfterUpdate()
activeClicked = False
completeClicked = True
Me.Requery
OtherSubForm.Requery
Form_frmTasks.sfTasks.SetFocus
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rs As DAO.Recordset
Dim sql As String
Dim isActive As Boolean
Dim dActivationDate As Date
If editClicked = True Then
editClicked = False
Exit Sub
End If
dActivationDate = Now()
Me!ActivationDate = dActivationDate
If activeClicked Or completeClicked Or taskClicked Then
If completeClicked Then
If Me!Complete = True Then
'was incomplete became complete
Me!Active = False
End If
If Me.Complete = False Then
'deactivate previously active record
Set rs = CurrentDb.OpenRecordset("Select * from tblTasks where tblTasks.Active = True")
If rs.RecordCount > 0 Then
appendTblTasksLog rs("Task"), Not rs("Active"), dActivationDate
End If
rs.Close
deactivatePreviousTask dActivationDate
Me!Active = True
End If
End If
If activeClicked Then
If Me!Active = True Then
If Me!Complete = True Then Me!Complete = False
'was inactive became active
'deactivate previously active record
Set rs = CurrentDb.OpenRecordset("Select * from tblTasks where tblTasks.Active = True")
If rs.RecordCount > 0 Then
appendTblTasksLog rs("Task"), Not (rs("Active")), dActivationDate
End If
deactivatePreviousTask dActivationDate
End If
End If
If Me.Active = False Then
'was active became inactive
End If
'task clicked
If taskClicked Then
If Me!Active = True Then
If Me!Complete = True Then Me!Complete = False
'was inactive became active
'deactivate previously active record
Set rs = CurrentDb.OpenRecordset("Select * from tblTasks where tblTasks.Active = True")
If rs.RecordCount > 0 Then
appendTblTasksLog rs("Task"), Not (rs("Active")), dActivationDate
End If
deactivatePreviousTask dActivationDate
End If
End If
If Me.Active = False Then
'was active became inactive
End If
End If
'Append a new record in tblTasksMonitor
appendTblTasksLog Me!Task, Me!Active, dActivationDate
End Sub
Private Sub Task_AfterUpdate()
Me.Requery
OtherSubForm.Requery
End Sub
Private Sub Task_Click()
If editClicked = False Then
'apply activation
taskClicked = True
Active = Not (Active)
'RunCommand acCmdSaveRecord
End If
'Stop
completeClicked = False
activeClicked = False
Me.Requery
OtherSubForm.Requery
Form_frmTasks.sfTasks.SetFocus
End Sub
Private Sub Task_DblClick(Cancel As Integer)
editClicked = True
Me!Task.Locked = False
End Sub
Private Sub Task_LostFocus()
Me!Task.Locked = True
End Sub
|