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

Query based in Check Box

Hi,

Noob alert!!!

Consider you have a table and one of the columns is a date, but not records have it depending on their status.
Date is filled in only at a certain step....

Now consider you would wish to create a query that would show either only records that have the date filled in or all values (regardless if date is there or not).

I would presume the easiest way would be to use form and a check box to determine the user's whims, if he wants only with date (checked) or all records (unchecked).

Created the query, the form, the check-box and the button.
I'm stuck at the point where I have to link the check-box to the query criteria.

Thanks
Aug 18 '14 #1
2 1595
twinnyfo
3,653 Expert Mod 2GB
alecs101,

Again, it depends on how you want to do this, as there are many ways. However, it really depends on how you are going to use the data. It this going to create a separate report in which having a standalone query might be useful? Or are you merely goingt o filter records that are already displayed for the user.

If you already have your form that lists ALL records, then the easiest way would be to create the query (or a filter) for your displayed records.

In the AterUpdate property of your check box, you would have something similar to this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub chkWithDate_AfterUpdate()
  2.     Dim strFilter As String
  3.     If Me.chkWithDate Then
  4.         strFilter = "DateField Is Not Null"
  5.         Me.Form.Filter = strFilter
  6.         Me.Form.FilterOn = True
  7.     Else
  8.         Me.Form.FilterOn = False
  9.     End If
  10. End Sub
But, please, please, PLEASE!!! do not name your date field "Date" as this is a reserved word in VBA and you will have many many problems if you do.....

Hope this helps!
Aug 18 '14 #2
NeoPa
32,556 Expert Mod 16PB
FYI: Me.Form is synonymous with Me. That is to say adding .Form is entirely unnecessary in this code.

To confirm, run the following code from the Immediate pane, ensuring first you have a form named {frmTest} :
Expand|Select|Wrap|Line Numbers
  1. ?(Form_{frmTest}.Form Is Form_{frmTest})
You should see a result of True which indicates they are the same object.
Aug 18 '14 #3

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

Similar topics

2
by: JDJones | last post by:
Using PHP and MySQL. Trying to put a list of categories into a drop down select option of a form like: <form name="form" action="<? print $_SERVER?>" method="get"> <select name="subject">...
1
by: Matthew | last post by:
Hey, I have built a form that has certain combo and text boxes on it, which a user specifies his criteria and then clicks on a search button to run a query based on that criteria. To build to...
3
by: Stijn Vanroye | last post by:
Hi List, I'm running a query on a not-so-small db. Mostly this query runs fast enough, but every once in a while the query takes a long time to complete in wich case the users start banging away...
2
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 =...
3
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...
5
by: Ferasse | last post by:
Hi, I'm an occasional Ms-Access developer, so there is still a lot of stuff that I don't get... Right now, I'm working on a database that stores contractual information. One of the form that...
4
by: exrcizn | last post by:
I am creating a query in Access 2003 that basically displays data in certain fields in a table (plain and simple basic stuff). I have a field in the table that may or may not contain data. If the...
2
by: scolivas | last post by:
I would like to make a form that creates a query. I know that I could make a query for each radio button instance but that would take forever! So basically what i have is 10 Fields in a query ...
1
Fspinelli
by: Fspinelli | last post by:
Hi, I have to run a query based on check boxes that are checked. Only those records with a specific check box (or boxes) should come up. I created a form off of that query using those check...
3
reginaldmerritt
by: reginaldmerritt | last post by:
I have a table TBStaff with boolean fields to show their type of employment. Staff can have many types of employment (upto 6). TBStaff StaffID_________Autonumber (PK) Forenames_____Text ...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.