G
Girl Scout
I have been trying to create a form similar to the one on the template
"Issues" from this site. I obviously needed different controls, but the
general concept should be the same. At least I thought so.
The code below is what I came up with:
Private Sub btnSearch_Click()
Dim strWhere As String
strWhere = "1=1"
' If tbxAESearch
If Not IsNull(Me.tbxAESearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtAcctExec] = " &
Me.tbxAESearch & ""
End If
' If tbxClientSearch
If Not IsNull(Me.tbxClientSearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtClientName] = " &
Me.tbxClientSearch & ""
End If
' If tbxDeptSearch
If Not IsNull(Me.tbxDeptSearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtDepartment] = " &
Me.tbxDeptSearch & ""
End If
'If tbxJobSearch
If Nz(Me.tbxJobSearch) <> "" Then
' Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "frmJobs.txtJobName Like '*" &
Me.tbxJobSearch & "*'"
End If
'DoCmd.OpenForm "frmJobs", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.Form.Visible Then
Me.Form.Visible = True
Something is wrong, I haven't been able to figure out how to get it to open
the form "frmJobs" using the information filled out on the "frmSearchJobs".
I planned on having the code above connected to a button, "btnSearch".
I know very little VBA, I pretty much have played with code and am having a
problem with this concept.
Please help me. I am trying to do this for work and am running out of time.
If more information is needed please let me know.
Thanks
"Issues" from this site. I obviously needed different controls, but the
general concept should be the same. At least I thought so.
The code below is what I came up with:
Private Sub btnSearch_Click()
Dim strWhere As String
strWhere = "1=1"
' If tbxAESearch
If Not IsNull(Me.tbxAESearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtAcctExec] = " &
Me.tbxAESearch & ""
End If
' If tbxClientSearch
If Not IsNull(Me.tbxClientSearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtClientName] = " &
Me.tbxClientSearch & ""
End If
' If tbxDeptSearch
If Not IsNull(Me.tbxDeptSearch) Then
'Create Predicate
strWhere = strWhere & " AND " & "frmJobs.[txtDepartment] = " &
Me.tbxDeptSearch & ""
End If
'If tbxJobSearch
If Nz(Me.tbxJobSearch) <> "" Then
' Add it to the predicate - match on leading characters
strWhere = strWhere & " AND " & "frmJobs.txtJobName Like '*" &
Me.tbxJobSearch & "*'"
End If
'DoCmd.OpenForm "frmJobs", acFormDS, , strWhere, acFormEdit,
acWindowNormal
If Not Me.Form.Visible Then
Me.Form.Visible = True
Something is wrong, I haven't been able to figure out how to get it to open
the form "frmJobs" using the information filled out on the "frmSearchJobs".
I planned on having the code above connected to a button, "btnSearch".
I know very little VBA, I pretty much have played with code and am having a
problem with this concept.
Please help me. I am trying to do this for work and am running out of time.
If more information is needed please let me know.
Thanks