Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Access Query using Between statement

Reply  
Thread Tools
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
18-Nov-2009, 03:03 PM #1
Solved: Access Query using Between statement
Hi
I have used the Between statement in a query where the attached form provides 2 numbers. My problem now is that the form will provide a single numeric value(say 46). My query needs to use this value with a + or - fixed integer. (Say +/-8)I have tried to modify the Between statement with no success.
Can anyone help please?
Alan
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-Nov-2009, 03:07 PM #2
Alan, let me be clear on what you want.
You have Search Form, on the Form you have the Starting Value (46) and you want to be able to set or select a a difference to the Finishing value say +8?
So the Start is 46 and the finish is 54?
__________________
OBP
I do not give up easily
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
18-Nov-2009, 03:11 PM #3
The form provides an age, say 46. I want to use an age between 38 and 54.
Alan
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-Nov-2009, 03:23 PM #4
But will the user Input or select the plu or minus 8 or is that going to be fixed?
If it is fixed then use
Between forms![formname]![Age] - 8 and forms![formname]![Age] +8
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
18-Nov-2009, 03:27 PM #5
In this use the it is a fixed value so I will use your statement. What would it be if the user supplies the variation?
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
18-Nov-2009, 03:30 PM #6
Well I would use 2 invisible fields on the form to hold a start and finish value and use VBA code to populate it.
However you could use

Between forms![formname]![Age] - forms![formname]![Step] and forms![formname]![Age] + forms![formname]![Step]

where step is the value that the user has input.
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
18-Nov-2009, 03:36 PM #7
Thanks for that. These answers are just what I wanted.
Cheers.
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
19-Nov-2009, 04:57 PM #8
I now have a form with an underlying query which provides data required for 2 text boxes on the form. This Form/Query works but how can I link the required data from the query to the text boxes in the form. I don't particularly want to see the query, just get the data. So far my text boxes have displayed ?Name. Any suggestions gratefully received.
Alan
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
20-Nov-2009, 06:14 AM #9
Are the 2 text boxes on a Form showing the Uotput from the search?
if they are you can refer to the fields on the original search form by using the same
forms![Formname]![Fieldname]
that you used in the query by putting it in the Control Source of the fields on the output form.
__________________
OBP
I do not give up easily
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
20-Nov-2009, 01:03 PM #10
The overall objective is to have a form on which there are 3 combo's, Forename, Surname and approx. age.
3 search options 1. by individual personal ident
2. To list all in household ident
3. By Forename and Surname as individual
from the same query and table
I am envisaging an Option group for selection of relevant search.
Option 1 - Form provides data for Forename, Surname and age to query on a table. Text box on form relates to a field in the query obtained from table. This data is then used to obtain data from the table relating to that ident. (individual)
Option 2 - As above but used to obtain data from table about any individual at that location
Option 3 - Form provides Forename and Surname to Query to obtain data about any individual of that name regardless of age or location.
i'm not sure yet how to achieve all this so decided to tackle it piecemeal.
Incidentally this is data gathered from census returns covering nearly80 years
OBP's Avatar
OBP OBP is offline
Computer Specs
Distinguished Member with 14,665 posts.
 
Join Date: Mar 2005
Location: UK
Experience: An old Basic Programmer
20-Nov-2009, 01:29 PM #11
Alan, I am surprised you didn't ask me directly about this one.
I have posted a few versions of a Search Form like you described (but more complicated)
I have also posted a VBA version that creates the Query using VBA SQL.
Here is the more complicated Search Form, if you want the VBA SQL version just let me know, note the "Option" column in the query.

By the way there is also a Form Filter version as well where the census records are on the form.
Attached Files
File Type: zip search.zip (180.7 KB, 3 views)
__________________
OBP
I do not give up easily
TumTee Tum's Avatar
Junior Member with 18 posts.
 
Join Date: Apr 2009
Experience: Beginner
21-Nov-2009, 01:35 PM #12
I've had a look at this and can see what is going on but can't see how I can relate it to my problem. I had a lot of help in the past to do this but as events have progressed the requirements have changed. I think I will have to have a form/query combination for each option. Bit untidy but should work.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:52 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.