Advertisement
Advertisement
| 07.21.2008 at 03:43PM PDT, ID: 23583671 |
|
[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: |
Private Sub CloseForm_Click()
Dim strIsFilled As String
'Check to see if there is an argument
strIsFilled = Nz([Forms]![FilterSort]![FieldList].[Value], "")
Dim strField As String
Dim strValue As String
Dim strFieldPos As String
Dim intAscDesc As Integer
Dim strAscDesc As String
Dim strSQL As String
If (Not (strIsFilled = "")) Then
strField = [Forms]![FilterSort]![FieldList].[Value]
strFieldPos = [Forms]![FilterSort]![FieldPosition].[Value]
intAscDesc = [Forms]![FilterSort]![Sort Order_Frame].Value
If (intAscDesc = 0) Then
strAscDesc = "ASC"
Else
strAscDesc = "DESC"
End If
strSQL = "SELECT [2007 JOB LOG].* "
strSQL = strSQL & "FROM [2007 JOB LOG] "
If (strFieldPos = "Whole field") Then
strValue = """" & [Forms]![FilterSort]![Value].[Value] & """"
strSQL = strSQL & "WHERE ([" & strField & "] = " & strValue & ") "
ElseIf (strFieldPos = "Start of the field") Then
strValue = """" & [Forms]![FilterSort]![Value].[Value]
strSQL = strSQL & "WHERE ([" & strField & "] LIKE " & "" & strValue & "*" & """" & ") "
Else
strValue = [Forms]![FilterSort]![Value].[Value]
strSQL = strSQL & "WHERE ([" & strField & "] LIKE " & """" & "*" & strValue & "*" & """" & ") "
End If
strSQL = strSQL & "ORDER BY [Job Number] " & strAscDesc
strSQL = strSQL & ";"
Else
strSQL = ""
End If
'Hide the FilterSort Form
Me.Visible = False
'MsgBox ("Opening 2007 Job Log with this SQL - '" & strSQL & "'")
DoCmd.Close acForm, "2007 Job Log", acSaveYes
DoCmd.OpenForm "2007 Job Log", acNormal, , , acFormAdd, acWindowNormal, strSQL
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Form_Open(Cancel As Integer)
Dim strArg As String
Dim strSQL As String
'Check to see if there is an argument
strArg = Nz([Forms]![2007 Job Log].OpenArgs, "")
'MsgBox "Argument = " & strArg
If Len(strArg) > 0 Then
' ok we have an argument
strSQL = strArg
Else
' no argument
strSQL = "SELECT [2007 JOB LOG].* "
strSQL = strSQL & "FROM [2007 JOB LOG] "
strSQL = strSQL & "ORDER BY [2007 JOB LOG].[Job Number] ASC;"
End If
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
'Use the ADO connection that Access uses
Set cn = CurrentProject.AccessConnection
'Create an instance of the ADO Recordset class, and set its properties
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = strSQL
'.LockType = adLockOptmistic
'.CursorType = adOpenKeyset
.Open
End With
'Set the form's Recordset property to the ADO recordset
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
End Sub
|