natekris8183
New member
- Local time
- Today, 14:34
- Joined
- Nov 21, 2012
- Messages
- 8
I have hit a minor road block. (AC 2010) We are putting together a CRM (this is a patchwork fix probably for the next 24 months while we implement something more robust). There are several custom search boxes that automatically updated on the main member profile record form to show certain data (scheduled follow-up calls, existing accounts, etc.). However, one of the tables is designed with a major product type and a minor product type (i.e. Checking [major], Interest bearing [Minor]).
Below is the vba being used for the search for the individial record per member by social, but a second varWhere for major product type needs to be input so that two separate listboxes can be segregated to allow multiple sections on the form for Major Product types. When Input the LIKE as "Checking" (for example) it searched all boxes instead of just the one where thes str was. Hopefully this makes since as I only consider myself an intermediate when it comes to visual basic code.
'The statement below refers your table you are gathering information for and the required fields, replace "tblSaveLogon" with you table name and the information after "." with all the required fields you need. In my example below i have 4 fields which i want to appear in the list box.
Thanks for the help!
strSql = "SELECT tblMemDepPrdInfo.[MemDepPrdInfoID], tblMemDepPrdInfo.[MemDepPrdInfoMem],tblMemDepPrdInfo.[MemDepPrdInfoMajType], tblMemDepPrdInfo.[MemDepPrdInfoMinType], tblMemDepPrdInfo.[MemDepPrdInfoDateOpen], tblMemDepPrdInfo.[MemDepPrdInfoStatus], tblMemDepPrdInfo.[MemDepPrdInfoDateClosed], tblMemDepPrdInfo.[MemDepPrdInfoReasonClosed], tblMemDepPrdInfo.[MemDepPrdInfoNotes] FROM tblMemDepPrdInfo"
varWhere = "WHERE"
'The statement below is to "ORDER" the results by which ever field you require, in my example its the field "Time"
strOrder = "ORDER BY tblMemDepPrdInfo.[MemDepPrdInfoDateOpen];"
' Check for LIKE Social
If Me.MemSSN > "" Then
varWhere = varWhere & "(tblMemDepPrdInfo.[MemDepPrdInfoMem]) LIKE """ & Me.MemSSN & "*"" "
varWhere = varWhere & "(tblMemDepPrdInfo.[MemDepPrdInfoMajType]) LIKE """ & "Checking" & "*"" "
End If
If varWhere = "" Then
varWhere = "9999999999999"
End If
Me.List247.RowSource = strSql & " " & varWhere & "" & strOrder
varWhere = Mid(varWhere, 1, Len(varWhere) - 8)
Below is the vba being used for the search for the individial record per member by social, but a second varWhere for major product type needs to be input so that two separate listboxes can be segregated to allow multiple sections on the form for Major Product types. When Input the LIKE as "Checking" (for example) it searched all boxes instead of just the one where thes str was. Hopefully this makes since as I only consider myself an intermediate when it comes to visual basic code.
'The statement below refers your table you are gathering information for and the required fields, replace "tblSaveLogon" with you table name and the information after "." with all the required fields you need. In my example below i have 4 fields which i want to appear in the list box.
Thanks for the help!
strSql = "SELECT tblMemDepPrdInfo.[MemDepPrdInfoID], tblMemDepPrdInfo.[MemDepPrdInfoMem],tblMemDepPrdInfo.[MemDepPrdInfoMajType], tblMemDepPrdInfo.[MemDepPrdInfoMinType], tblMemDepPrdInfo.[MemDepPrdInfoDateOpen], tblMemDepPrdInfo.[MemDepPrdInfoStatus], tblMemDepPrdInfo.[MemDepPrdInfoDateClosed], tblMemDepPrdInfo.[MemDepPrdInfoReasonClosed], tblMemDepPrdInfo.[MemDepPrdInfoNotes] FROM tblMemDepPrdInfo"
varWhere = "WHERE"
'The statement below is to "ORDER" the results by which ever field you require, in my example its the field "Time"
strOrder = "ORDER BY tblMemDepPrdInfo.[MemDepPrdInfoDateOpen];"
' Check for LIKE Social
If Me.MemSSN > "" Then
varWhere = varWhere & "(tblMemDepPrdInfo.[MemDepPrdInfoMem]) LIKE """ & Me.MemSSN & "*"" "
varWhere = varWhere & "(tblMemDepPrdInfo.[MemDepPrdInfoMajType]) LIKE """ & "Checking" & "*"" "
End If
If varWhere = "" Then
varWhere = "9999999999999"
End If
Me.List247.RowSource = strSql & " " & varWhere & "" & strOrder
varWhere = Mid(varWhere, 1, Len(varWhere) - 8)