473,657 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search in Form

83 New Member
LSI Case Number is an ID. It is constructed by "the month (1 or 2 digits) &theyear(2digit s) & "-" & three digit number. I want to create a search for it on a form. In the following code the insured name and policy number work, but the case number doesn't. At first I tried to just set the find [LSI Case Number] = '" &_ Me.Find_Case_Nu mber"' , but I think it didn't work because the hyphen...
So I tried to remove the hyphen on both the search and the find...as it shows below. Either this won't work, or I messed up with either a " or a '. Please help...thanks.
One more thing... I want to create a form to create a query based on certain query. Am I going to create a form with searches like the ones below? any direction will help.

[code]
Private Sub CheckFilter()
Dim strFilter As String, strOldFilter As String

strOldFilter = Me.Filter
If Me.Find_Case_Nu mber > "" Then _
strFilter = strFilter & _
" AND (Left([LSI Case Number],Instr(1,[LSI Case Number]," - ")-1) & Right([LSI Case Number],Instr(1,[LSI Case Number]," - ")+1) = " & _
Left([Find Insured Name], InStr(1, [Find Insured Name], "-") - 1) & Right([Find Insured Name], InStr(1, [Find Insured Name], "-") + 1) & ")"

If Me.Find_Insured _Name > "" Then _
strFilter = strFilter & _
" AND ([Insured Name]='" & _
Me.Find_Insured _Name & "')"

If Me.Find_Policy_ Number > "" Then _
strFilter = strFilter & _
" AND ([Policy Number]='" & _
Me.Find_Policy_ Number & "')"

If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")
End If
End Sub
Apr 14 '07 #1
4 1420
jl2886
83 New Member
Does anyone have an answer?

LSI Case Number is an ID. It is constructed by "the month (1 or 2 digits) &theyear(2digit s) & "-" & three digit number. I want to create a search for it on a form. In the following code the insured name and policy number work, but the case number doesn't. At first I tried to just set the find [LSI Case Number] = '" &_ Me.Find_Case_Nu mber"' , but I think it didn't work because the hyphen...
So I tried to remove the hyphen on both the search and the find...as it shows below. Either this won't work, or I messed up with either a " or a '. Please help...thanks.
One more thing... I want to create a form to create a query based on certain query. Am I going to create a form with searches like the ones below? any direction will help.

[code]
Private Sub CheckFilter()
Dim strFilter As String, strOldFilter As String

strOldFilter = Me.Filter
If Me.Find_Case_Nu mber > "" Then _
strFilter = strFilter & _
" AND (Left([LSI Case Number],Instr(1,[LSI Case Number]," - ")-1) & Right([LSI Case Number],Instr(1,[LSI Case Number]," - ")+1) = " & _
Left([Find Insured Name], InStr(1, [Find Insured Name], "-") - 1) & Right([Find Insured Name], InStr(1, [Find Insured Name], "-") + 1) & ")"

If Me.Find_Insured _Name > "" Then _
strFilter = strFilter & _
" AND ([Insured Name]='" & _
Me.Find_Insured _Name & "')"

If Me.Find_Policy_ Number > "" Then _
strFilter = strFilter & _
" AND ([Policy Number]='" & _
Me.Find_Policy_ Number & "')"

If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")
End If
End Sub
Apr 16 '07 #2
MMcCarthy
14,534 Recognized Expert Moderator MVP
As this is a string the hyphen wouldn't make any difference.
Expand|Select|Wrap|Line Numbers
  1. [LSI Case Number] LIKE '" & Me.Find_Case_Number"'
this should work.
Apr 16 '07 #3
jl2886
83 New Member
Thanks, worked perfectly.

As this is a string the hyphen wouldn't make any difference.
Expand|Select|Wrap|Line Numbers
  1. [LSI Case Number] LIKE '" & Me.Find_Case_Number"'
this should work.
Apr 17 '07 #4
MMcCarthy
14,534 Recognized Expert Moderator MVP
Thanks, worked perfectly.
You're welcome.
Apr 17 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2095
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would like to have the search from data displayed in a form. The structure that I have for this was take from the Asset Manger from MS. Anyway I open a report that in turn opens up a search form that allow me to select data. Then you continue by...
8
3210
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled 'search' may be clicked on by the user and the user can then search all records by postcode. I want to do this to prevent duplicate data entry.
2
2262
by: Mark | last post by:
Hi All, I am creating a music database for a friend and have run into a problem. Within the ALBUM table, I wanted to store the ARTIST_ID rather than the ARTIST_NAME. To do this, I intended to have have a command button on the album form which would open a search form (based on the artist table). This works as I wanted and allows me to get to one record. I then planned to have a button on the search form which when clicked, would updated...
12
2338
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two works, thats: 1. Category to search from the (Drop down name: ASPDBCatSearch) is working with the Input Text Box Field (name: keyword), based on Whatever selection on the Drop down value selection:
0
963
by: djpaul | last post by:
Hello! I am getting this error when i open a new form into antoher form. System.AccesViolationException - Attempted to read or write protected memory. What i do is : Dim PrintView as new PrintForm() PrintView.ReportName = "SaleView" PrintView.GetPaymentChoice = Data PrintView.GetQuery = Query PrintView.Show(Me)
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.