473,378 Members | 1,478 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,378 software developers and data experts.

filtering records in form by date based on value in combo box

2
i have a microsoft access database. it has a customers table and a date of entry of each customer. i have a form which includes all customers and their info.

i want to make a combo box (drop down box) that would include months of the year (January, February, March, April...) . when the user chooses April from the combo box, only the records which were added in that month will show up in the records table.

can this be done? i have been trying to do this for at least 3 days but no luck..

Kind regards.
Oct 5 '13 #1
3 3330
zmbd
5,501 Expert Mod 4TB
Easy enough...
For fairly small databases I do the following:

tbl_months
[months_pk] numeric(long)
[months_fullname] text(10)
[months_shortname] text(3)
>I use this table to feed my listbox. The row source is an SQL that pulls [months_pk] ast the first column and is the bound column; the second and/or third column as I need. Also, sorts the months on the primary key... so that Jan is before Apr (^_-)

In a query, you will need to create a calculated field.
calc_mo: month([fieldwithdate])
this will only work a date/time typecast field and it returns the numeric month (April = 4, etc...)
Becarefull with using reserved words and symbols! Access 2007 reserved words and symbols

In VBA, you can then use the selected value in the list box (or combo box) to build your SQL with the WHERE clause based on that value and any other restricting criteria.

In a pure SQL/Stored Query, you would create a parameter that will either popup the basic inputbox with a prompt to enter the numeric month, or you would create a form that the query will use for the parameter value(s).([url=http://office.microsoft.com/en-us/access-help/using-parameters-with-queries-and-reports-HA001117077.aspx(acc2003)[/url] <Newed examples use the Macro language which is not the same as VBA. Unless you'll be publishing to a sharepoint site, IMHO stick with the VBA versions)
Oct 5 '13 #2
moeido
2
ok there has been a change in plan.

the table has a date for each customer.

i want to make a text box which would take a date as input.

it will show all customers at the specified date.

can this be done? if yes how?


also, i want to make a record list that would show the records of all customers depending on a certain YES/NO field.

is it possible?

thanks very much.
Oct 5 '13 #3
zmbd
5,501 Expert Mod 4TB
moeido:

All of the answers to the additional questions are basically the same - yes it can be done, the Queries are basically the same for filtering and the textbox would have either code behind it or a command button; however, we ask that each thread contain only one question. This is to make it easier to keep the answers on-topic and so that members can more easily search for answers to their own, similiar, questions.
Oct 5 '13 #4

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

Similar topics

3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
1
by: MLH | last post by:
I have a form (xxxxxxxxxxxxxx) with a combo-box control (yyyyyyyyyyyyyy). The rowsource property for that combo box is as follows: SELECT DISTINCTROW ., . FROM ; The SQL for qryVehicleList...
1
by: hackerslacker | last post by:
I have an ordering form that use two combo boxes to filter down the records of a Products table. This worked fine with the after_Update of the first filtering the records and creating the...
49
dima69
by: dima69 | last post by:
Hi all. Here is a problem. I want to sort a form by absolute value. Let's say, if I have a field named "theSum", I'd like to set the form OrderBy property to "Abs()". If I use "Advanced...
2
by: dympna | last post by:
Hi can anyone suggest a fix for this... as I am a novice in access. I have created a training table with the following fields Employee Name - joe Training Received - Fork lift Date Received...
14
by: TerdFerguson | last post by:
Hi everybody! I'm a total newbie at access, just opened it for the first time yesterday so bear with me. I tried a search for my answer and found similar topics but couldn't find the exact answer....
2
by: SHAWTY721 | last post by:
I have a form that contains two combo boxes that are related to each other. I need to find a way to populate my text box based on the criteria of the two combo boxes so the appropriate number...
5
by: Thelma Roslyn Lubkin | last post by:
I am still having trouble trying to use a popup form to allow user to set filters for the main form. The main form is based on a single table. The popup contains 5 listboxes, so the user can...
20
by: Daniel Yantis | last post by:
Combo Box 1 Displays a query/list with 2 columns: SELECT Classes.CLASS_DESC, Judges.Judge, * FROM Classes; Combo Box 2 Displays a query/list: SELECT Judges.Judge FROM Judges; I want...
6
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.