473,748 Members | 9,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filter query based on the combobox/textbox

57 New Member
Hi friends,

I am using A2010. I have completed preparing the whole application but stuck with reports.

what I want to do:

There is 1 command button and 1 textbox/combobox(happy if works with any of the control) . When I type employeeId(whic h is numeric) in that control and click on command button, it should filter the query and display the result in report. It sounds easy , but not for me. I tried lots of ways to get it done. But from past 6 days stuck with this.

I am using query to fetch data in unbound combobox.

SELECT tblUserqry.[EmployeeId] FROM tblUserqry;

And below criteria in query:

Like [Forms]![Form3]![EmpID]

'EmpID is name of combobox

At last below Macro for onclick , that opens the query in datasheet .


Please note that I don't know how filter works in ms access. All types of suggestions are accepted.

I need to complete it ASAP.

Please help.

Looking forward for participations.
May 21 '15 #1
5 3716
jimatqsi
1,276 Recognized Expert Top Contributor
Sandy1992,
First, let me quibble with your wording. You say you are stuck on 'reports' but you then describe a problem with opening a query. Viewing query results is not viewing a report; they are different things. I think there is no report involved. Please correct me if I am wrong.

Further, you don't tell what the problem is. You have button that runs this macro. The macro opens a query. It is not clear what the name of that query is. You describe this other(?) query:
Expand|Select|Wrap|Line Numbers
  1. SELECT tblUserqry.[EmployeeId] FROM tblUserqry; 
and then you describe a where clause
Expand|Select|Wrap|Line Numbers
  1. Like [Forms]![Form3]![EmpID]
Is that where clause part of the combobox query? That wouldn't make sense, so I think it must be part of the query the macro opens. And that looks pretty good, like it should work.

What happens when you click the button? You don't tell what result you are getting.

I think what you need to do is pretty simple. Getting help "asap" on this website should not be a problem if you will restate your problem clearly and completely. Give us more detail.

And congratulations on sticking with it. Six days fighting a program is frustrating.

Jim
May 21 '15 #2
Sandy1992
57 New Member
Thanks a lot for your response. But I solved my problem :)
May 21 '15 #3
zmbd
5,501 Recognized Expert Moderator Expert
Sandy1992,
Very happy you solved your problem; however, perhaps you would be willing to share so that others may potentially benefit from your experience?
May 22 '15 #4
Sandy1992
57 New Member
Yeah Sure,

I will more than happy if I can help. :)

what I did is simple.

I used combobox to fetch the data to filter my form.

In Property window, under Row Source I used
Expand|Select|Wrap|Line Numbers
  1. SELECT [AddUser].[ID], [AddUser].[EmployeeId] FROM AddUser; 
This way my combobox was displaying the data which I wanted.

Now, I used a subform to show the filtered result in it.

I created a query and on the field I really wanted to filter I used :
Expand|Select|Wrap|Line Numbers
  1. Like [Forms]![Searchbyemployeeid]![EmpID]
And lastly, on Combobox -> after update I used code :
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboEmployee_AfterUpdate()
  2.  Dim Myemp As String
  3.     Myemp = "select * from Tasks where ([EmployeeId] =" & Me.cboEmployee & ")"
  4.     Me.Tasks_subform.Form.RecordSource = Myemp
  5.     Me.Tasks_subform.Requery
  6.  
  7.  
  8. End Sub
Try it out. Simple and fun :)
May 26 '15 #5
zmbd
5,501 Recognized Expert Moderator Expert
thnx you.... you might take a look at our Insights articles. There are several examples of filtering methods:
May 26 '15 #6

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

Similar topics

11
11990
by: Matt | last post by:
Hi everyone, still pretty new to MySQL. I was wondering if there is a way to automatically filter records based on a mysql userlogin name?? I have serveral databases that I want to combine in order to manage the databases more efficiently. - I'm currently using MySQL 4.1.12 and I'm currently testing 5.0.14 - I have a databases for each user account. - Each database has the same schema and entity relation model.
5
2701
by: RICHARD BROMBERG | last post by:
I am using MS Access 2000 and crating an application where the main table has about 90 fields. I understand how to run a where the value of a PARTICULAR field is entered into a text box. I want to allow the user to enter the FIELD into one text box and the CRITERIA into another text box and then run a query based on the values entered. I'd appreciate any ideas how to do this
8
9996
by: Krul | last post by:
I like to have a blank entry at top of the combobox list, so the user is able to clear the combobox. Right now, the form displays a empty entry on load, but after chosen a value once, it is not possible to select a blank entry again. The only way is to delete the string manually and press enter.
2
9345
by: amith.srinivas | last post by:
Hi all, From a word macro in VBA, I am trying to create a report in access DB. The report is based on a query with a parameter. I am using Set rpt = Application.CreateReport rpt.RecordSource = <<Query_Name>> Once I create the report, I m trying to create labels to display the Report title in the Report Header section.
3
2338
by: somethings.amiss | last post by:
I searched google groups for an answer but found none that I could completely understand. I have a table. It contains fields such as 'client,date,hours,project,employee.' I have a form that lists all the clients on one tab. On another tab in the same form all the employees are listed. Each have a check box next to them (both client and employee). I want to run a query based on what is checked on both tabs. Thanks in advance for any...
6
2118
by: Drum2001 | last post by:
I have a database where I need to query multiple items. Is it possible to run a query based on a textbox where the information is delimited by a comma. Example: Show me all names where Social Security Number: = 111223333, 444556666, 777889999
94
6921
by: mlcampeau | last post by:
I have a report (JobVacanciesOnly) that has a subreport (JobVacanciesOnlySR) that are based on two separate queries. MY - JobVacancyJobs SELECT Job.Code, Job.Title, Job.Grade, Grade.Minimum, Grade.Midpoint, Grade.Maximum, Job.EEOCategoryCode, EEOCategory.Desc, Job.EEOSubCategoryCode, EEOSubCategory.Desc FROM Grade RIGHT JOIN (EEOSubCategory RIGHT JOIN (EEOCategory RIGHT JOIN Job ON EEOCategory.Code = Job.EEOCategoryCode) ON...
6
10826
gnawoncents
by: gnawoncents | last post by:
I have a form (FRMsurveyReports) with several combo boxes (e.g. Class, ClassUnique, SurveyID, etc.) which use an SQL query based on a table (TBLSurveyResponses) for their record source. The available options filter based on any criteria selected in the combo boxes above them. If nothing is selected, all options should be visible. For example, consider the following combo boxes below. ClassUnique SurveyID Using code #1 below, if I...
3
27717
by: Becker | last post by:
I have a form "Finish" which has a record source "finish query". Criteria for the query is that they must enter an item # to view only that record at that time. I want them to be able to just type the item # into a text box to view that record without having to close and reopen the form. I don't want the records to be editable and I don't want users to be able to scroll through records at the bottom of the window either. I don't know if...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9366
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...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
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
8239
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...
0
6073
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
4597
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...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.