D
Debbiedo
Hi,
I need to add a button that references a separate record source and
then displays the results in the details section.
To explain, the user(s) links to a table containing a nightly download
of data (view only). They need to compare this data (stored in the
FormsDataTest table) to their own table (CIT Table) using the
Student_ID to determine which students are not included in their own
table (CIT Table). These results need to be displayed in the details
section. The user(s) then clicks on the record's "edit record" button
and a data entry form (CIT Form) is opened up. This form contains a
main form (FormsDataTest data) and an associated subform (CIT Table
data) linked by "Student_ID". The user(s) populates the CIT Table with
the info they need to document and closes the form. Now the tables are
synched. The user(s) then can then use the search feature described
below to find a specific student. These results are also displayed in
the details section. We have over 65,000 students thus this data is
extremely dynamic.
So how can I convert the following code, which opens up in a sepatate
table window, to instead display in the details section when clicked?
The records displayed using the search code (cmdFilter) will need to
be cleared and replaced by the cmdNotNotified results and vice versa
depending on whether the user(s) selects the Search button or the Not
Notified button.
I hope this makes sense. Thanks again.
-------------Code to Convert---------------------
Private Sub cmdNotNotified_Click()
On Error GoTo Err_cmdNotNotified_Click
Dim stDocName As String
stDocName = "Not Notified Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdNotNotified_Click:
Exit Sub
Err_cmdNotNotified_Click:
MsgBox Err.Description
Resume Exit_cmdNotNotified_Click
End Sub
--------Search Filter Code for reference only. This works
great!----------
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
'Build Student ID criteria expresion
If Not IsNull(Me.txtFilterStudentID) Then
strWhere = strWhere & "([Student_ID] = """ &
Me.txtFilterStudentID & """) AND "
End If
'Build Last Name criteria expresion
If Not IsNull(Me.txtFilterLastName) Then
strWhere = strWhere & "([Last_Name] Like ""*" &
Me.txtFilterLastName & "*"") AND "
End If
'Build First Name criteria expresion
If Not IsNull(Me.txtFilterFirstName) Then
strWhere = strWhere & "([First_Name] Like ""*" &
Me.txtFilterFirstName & "*"") AND "
End If
' Build School Name criteria expression
If Len(Me.cboFilterSchool.Value & "") > 0 Then
strWhere = strWhere & "School_Name='" &
Me.cboFilterSchool.Value & "' And "
End If
' ... build "Approval" criteria expression
Select Case Me.frameApproval.Value
Case 1 ' Approved
strWhere = strWhere & "SPNDSBUS='X' And "
Case 2 ' Not Approved
strWhere = strWhere & "(Len(SPNDSBUS & '') = 0 ) And "
Case 3 ' Both
strWhere = strWhere & "([SPNDSBUS]OR(Len(SPNDSBUS & '') = 0))
And "
End Select
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing here"
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub
I need to add a button that references a separate record source and
then displays the results in the details section.
To explain, the user(s) links to a table containing a nightly download
of data (view only). They need to compare this data (stored in the
FormsDataTest table) to their own table (CIT Table) using the
Student_ID to determine which students are not included in their own
table (CIT Table). These results need to be displayed in the details
section. The user(s) then clicks on the record's "edit record" button
and a data entry form (CIT Form) is opened up. This form contains a
main form (FormsDataTest data) and an associated subform (CIT Table
data) linked by "Student_ID". The user(s) populates the CIT Table with
the info they need to document and closes the form. Now the tables are
synched. The user(s) then can then use the search feature described
below to find a specific student. These results are also displayed in
the details section. We have over 65,000 students thus this data is
extremely dynamic.
So how can I convert the following code, which opens up in a sepatate
table window, to instead display in the details section when clicked?
The records displayed using the search code (cmdFilter) will need to
be cleared and replaced by the cmdNotNotified results and vice versa
depending on whether the user(s) selects the Search button or the Not
Notified button.
I hope this makes sense. Thanks again.
-------------Code to Convert---------------------
Private Sub cmdNotNotified_Click()
On Error GoTo Err_cmdNotNotified_Click
Dim stDocName As String
stDocName = "Not Notified Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdNotNotified_Click:
Exit Sub
Err_cmdNotNotified_Click:
MsgBox Err.Description
Resume Exit_cmdNotNotified_Click
End Sub
--------Search Filter Code for reference only. This works
great!----------
Private Sub cmdFilter_Click()
Dim strWhere As String
Dim lngLen As Long
'Build Student ID criteria expresion
If Not IsNull(Me.txtFilterStudentID) Then
strWhere = strWhere & "([Student_ID] = """ &
Me.txtFilterStudentID & """) AND "
End If
'Build Last Name criteria expresion
If Not IsNull(Me.txtFilterLastName) Then
strWhere = strWhere & "([Last_Name] Like ""*" &
Me.txtFilterLastName & "*"") AND "
End If
'Build First Name criteria expresion
If Not IsNull(Me.txtFilterFirstName) Then
strWhere = strWhere & "([First_Name] Like ""*" &
Me.txtFilterFirstName & "*"") AND "
End If
' Build School Name criteria expression
If Len(Me.cboFilterSchool.Value & "") > 0 Then
strWhere = strWhere & "School_Name='" &
Me.cboFilterSchool.Value & "' And "
End If
' ... build "Approval" criteria expression
Select Case Me.frameApproval.Value
Case 1 ' Approved
strWhere = strWhere & "SPNDSBUS='X' And "
Case 2 ' Not Approved
strWhere = strWhere & "(Len(SPNDSBUS & '') = 0 ) And "
Case 3 ' Both
strWhere = strWhere & "([SPNDSBUS]OR(Len(SPNDSBUS & '') = 0))
And "
End Select
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing here"
Else
strWhere = Left$(strWhere, lngLen)
Debug.Print strWhere
Me.Filter = strWhere
Me.FilterOn = True
End If
End Sub