M
Michael Johnson
I have created a program with a custom search form and I
have figured out that in order for this form to work using
code I will have around 4096 different sections of code,
this is one for every possible combination. Is there an
easier way to do this then coding every section. Now that
I have actually got all the coding done I am getting a
procedure to large error message. Any help would would be
appreciated.
Thanks
Michael
Here is one section of my code
'Start Date Option 1
If start_date_option = True And carrier_option = True And
state_option = True And agent_id_option = True And _
sent_option = True And violation_option = True And
complete_option = True And title_option = True And _
description_option = True And error_option = True And
charged_option = True And employee_id_option = True And
word_option = True Then
strsearchresults = "select * from
[qry_letter_of_indemnity_tables] where [start_date] >= #"
& Format(strbegindate, "mm/dd/yyyy") & "# " _
& " and [start_date] <= #" & Format
(strenddate, "mm/dd/yyyy") & "# and [carrier] = '" &
strcarrier & "' and [annuity_signed_in_state] = '" &
strannuitystate & "'" _
& " and [agent_id] = '" & stragentid & "' and [loi_sent]
= '" & strloisent & "' and [compliance_violation] = '" &
strcomplianceviolation & "'" _
& " and [loi_complete] = '" & strloicomplete & "' and
[loi_summary_title] = '" & strsummarytitle & "' and
[loi_summary_description] = '" & strsummarydescription
& "'" _
& " and (([source_of_error] = '" & strerrorsource & "')
or ([second_source_of_error] = '" & strerrorsource & "')
or ([other_source_of_error] = '" & strerrorsource & "'))" _
& " and (([group_charged] = '" & strgroupcharged & "') or
([second_group_charged] = '" & strgroupcharged & "') or
([other_group_charged] = '" & strgroupcharged & "'))" _
& " and (([employee_id_1] = '" & stremployeeid & "') or
([employee_id_2] = '" & stremployeeid & "') or
([employee_id_3] = '" & stremployeeid & "') or
([employee_id_4] = '" & stremployeeid & "') or
([employee_id_5] = '" & stremployeeid & "'))" _
& " and (([loi_explanation] LIKE '*" & strwordsearch
& "*') or ([corrective_action] LIKE '*" & strwordsearch
& "*'))"
If rcs.RecordCount = 0 Then
strnorecord = MsgBox("No Records Found for this
Criteria", , "No Records Found")
Exit Sub
End If
End If
DoCmd.OpenForm "frm_search_option_results", acNormal
Forms!frm_search_option_results.RecordSource = stroption1
Call make_visible
Forms!frm_search_option_results!employee_id = strloggedinid
Exit Sub
have figured out that in order for this form to work using
code I will have around 4096 different sections of code,
this is one for every possible combination. Is there an
easier way to do this then coding every section. Now that
I have actually got all the coding done I am getting a
procedure to large error message. Any help would would be
appreciated.
Thanks
Michael
Here is one section of my code
'Start Date Option 1
If start_date_option = True And carrier_option = True And
state_option = True And agent_id_option = True And _
sent_option = True And violation_option = True And
complete_option = True And title_option = True And _
description_option = True And error_option = True And
charged_option = True And employee_id_option = True And
word_option = True Then
strsearchresults = "select * from
[qry_letter_of_indemnity_tables] where [start_date] >= #"
& Format(strbegindate, "mm/dd/yyyy") & "# " _
& " and [start_date] <= #" & Format
(strenddate, "mm/dd/yyyy") & "# and [carrier] = '" &
strcarrier & "' and [annuity_signed_in_state] = '" &
strannuitystate & "'" _
& " and [agent_id] = '" & stragentid & "' and [loi_sent]
= '" & strloisent & "' and [compliance_violation] = '" &
strcomplianceviolation & "'" _
& " and [loi_complete] = '" & strloicomplete & "' and
[loi_summary_title] = '" & strsummarytitle & "' and
[loi_summary_description] = '" & strsummarydescription
& "'" _
& " and (([source_of_error] = '" & strerrorsource & "')
or ([second_source_of_error] = '" & strerrorsource & "')
or ([other_source_of_error] = '" & strerrorsource & "'))" _
& " and (([group_charged] = '" & strgroupcharged & "') or
([second_group_charged] = '" & strgroupcharged & "') or
([other_group_charged] = '" & strgroupcharged & "'))" _
& " and (([employee_id_1] = '" & stremployeeid & "') or
([employee_id_2] = '" & stremployeeid & "') or
([employee_id_3] = '" & stremployeeid & "') or
([employee_id_4] = '" & stremployeeid & "') or
([employee_id_5] = '" & stremployeeid & "'))" _
& " and (([loi_explanation] LIKE '*" & strwordsearch
& "*') or ([corrective_action] LIKE '*" & strwordsearch
& "*'))"
If rcs.RecordCount = 0 Then
strnorecord = MsgBox("No Records Found for this
Criteria", , "No Records Found")
Exit Sub
End If
End If
DoCmd.OpenForm "frm_search_option_results", acNormal
Forms!frm_search_option_results.RecordSource = stroption1
Call make_visible
Forms!frm_search_option_results!employee_id = strloggedinid
Exit Sub