473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Filter Data based value in combo boxes

106 100+
Hi,

I have an accident claims form that I need to requery on one of three different fields.

Primary field is AccidentID
ClientName (Can appear on more than one AccidentID)
SolicitorsRef (unique to each accident claim but field can be null)
AccidentRefFinal (reference number for each claim)

from the main form, my comboboxes are:
cmbClientName and cmbAccRefFinal - These requery to find the requested data.

cmbSolRef, brings the required data plus all the nulls.
How can I avoid this to show only the record matching cmbSolRef.

Expand|Select|Wrap|Line Numbers
  1. SELECT tblPerson.Completed, Clients.ClientName, tblPerson.SolicitorsRef, tblPerson.AccidentID, tblPerson.AccidentRefFinal
  2. FROM Clients INNER JOIN tblPerson ON Clients.ContactID = tblPerson.ContactID
  3. WHERE (((Clients.ClientName) Like "*" & [Forms]![MMQ_Master_Client]![cmbClientName] & "*") AND ((tblPerson.SolicitorsRef) Like "*" & [Forms]![MMQ_Master_Client]![cmbSolRef] & "*" Or (tblPerson.SolicitorsRef) Is Null) AND ((tblPerson.AccidentID) Like "*" & [Forms]![MMQ_Master_Client]![cmbAccRefFinal] & "*"))
  4. ORDER BY tblPerson.Completed DESC;
  5.  
Your help is appreciated.
Jun 13 '10 #1
3 1947
jimatqsi
1,271 Expert 1GB
Not sure, but maybe you need to change
AND ((tblPerson.SolicitorsRef) Like "*"
to
AND ((nz(tblPerson.SolicitorsRef,' ')) Like "*"

Jim
Jun 13 '10 #2
tasawer
106 100+
No.. same result

I have now modified to a different method:

I have a 'cmdShowAll' button to show all records by setting all comboboxes to NULL and requery.

cmbAccRefFinal has RowSource:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblPerson.AccidentID, tblPerson.AccidentRefFinal, Clients.ClientName
  2. FROM tblPerson INNER JOIN Clients ON tblPerson.ContactID = Clients.ContactID
  3. ORDER BY tblPerson.AccidentID DESC;
  4.  
cmbClientName has RowSource:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblPerson.AccidentID, Clients.ClientName, tblPerson.AccidentRefFinal
  2. FROM Clients INNER JOIN tblPerson ON Clients.ContactID = tblPerson.ContactID
  3. ORDER BY Clients.ClientName;
  4.  
cmbSolRef has RowSource:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblPerson.AccidentID, tblPerson.SolicitorsRef
  2. FROM tblPerson INNER JOIN Clients ON tblPerson.ContactID = Clients.ContactID
  3. WHERE (((tblPerson.SolicitorsRef) Is Not Null))
  4. ORDER BY tblPerson.SolicitorsRef;
  5.  
in the AfterUpdate code of all comboboxes, I copy the first coloumn to a temporary text box, txtACCID

the underlying query is now filtered in this manner:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblPerson.AccidentID
  2. FROM Clients INNER JOIN tblPerson ON Clients.ContactID = tblPerson.ContactID
  3. WHERE (((tblPerson.AccidentID) Like nz([Forms]![MMQ_Master_Client]![txtAccID],' ') & "*"));
  4.  
cmbAccRefFinal and cmbClientName bring up the selected record.
but odd thing happen when I select cmbSolRef. e.g.:
when AccidentID=459, filtered records include AccidentID's beginning with 45

I am well confused.
Expert help is greatly appreciated
Jun 14 '10 #3
tasawer
106 100+
Resolved.

I created three textboxes and filled them with data from the comboboxes.
These three text boxes are then used as the search criteria.

Thanks
Jun 18 '10 #4

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

Similar topics

0
by: Joyce | last post by:
The XML Schema design problem to solve is as follows: We have 2 combo boxes to populate from schema data, let's say: 1. States 2. Cities (and this one gets populated depending on the choice of...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
2
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I've created a bound form to a table. I've added two lookup combo boxes so the user has a choice of how to look up a record (Individuals or Organizations). The...
4
by: Miguel | last post by:
I have synchronized combo boxes linking Account Type with Customer Names based on the template that Microsoft has in one of its samples databases. There are the appropriate relationships between...
9
by: natwong | last post by:
Hi All, I'm a newbie in terms of Access and some of its functionality . I've been stuck on this problem for a couple days, even after searching the Web, etc. Currently I have five combo boxes...
0
by: Josetta | last post by:
This is for informational purposes...I had a problem and I thought it might help others in a similar situation. I hope someone, someday, finds this idea useful. I've garnered so much knowledge...
5
by: NateDogg | last post by:
This is what I am using to filter my combo box based on what is selected in the previous box. Open the properties for the second combo box. Next to the 'Row Source' property, click on the '...'. ...
15
by: jonosborne | last post by:
hi, i hope someone can help, i have read a lot of tutorials relating to this matter but im afraid VBA isnt my strong point and i just need a touch of guidance. I have one table called which has...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: Mindspring | last post by:
I need some help with filtering. I not very savvy (yet) with c# so I am having a hard time figuring out how to filter results. Here is what I am trying to do. I am pulling data from a database...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.