473,487 Members | 2,622 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Query based in Check Box

4 New Member
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 1596
twinnyfo
3,653 Recognized Expert Moderator Specialist
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 Recognized Expert Moderator MVP
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
5674
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
4152
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
3366
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
9332
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
2323
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
10247
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
6532
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
4301
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
20506
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
2404
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
7106
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
6967
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
7137
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
7181
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
7349
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...
1
4874
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...
0
4565
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...
0
3076
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...
0
267
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...

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.