Solved

Access 2010 Between statement returns both positive and negative values

Posted on 2013-12-27
6
392 Views
Last Modified: 2013-12-27
I am using a between statement to pull 2 values from a text box in a form and return the fields that are between these values.  The field in question is a calculated field in another query and is joined to this query.  My problem:  my statement is treating the values as absolutes and is returning those in the between range that are both positive and negative.

For example, I have values that are 255, 376, 115, 543, -36, -125, -444.  If I send values to the between statement that are between 200 and 400, I get 255, 376, 543, and -444.

Please advise.
0
Comment
Question by:jwandmrsquared
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39742370
You need to provide the syntax you are using so that we can interpret what is going wrong.

I'm assuming this is a SQL statement?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39742435
< The field in question is a calculated field in another query and is joined to this query.>

in which field  did you place the "Between criteria" ?
   - in the calculated field in another query ?
0
 

Author Comment

by:jwandmrsquared
ID: 39742441
SELECT qry_pplc_all_action_items_to_email.Item_Status, qry_pplc_all_action_items_to_email.PPLCREV, qry_pplc_all_action_items_to_email.[Product ID], qry_pplc_all_action_items_to_email.[Product Action Items], qry_pplc_all_action_items_to_email.Resolution, qry_pplc_all_action_items_to_email.[Resolve Date], qry_pplc_all_action_items_to_email.AI_Owner, qry_pplc_all_action_items_to_email.AI_Owner_email, qry_pplc_all_action_items_to_email.[Product Name], qry_pplc_all_action_items_to_email.[Days to Orig Due Date], qry_pplc_all_action_items_to_email.[Days to Revised Date], qry_pplc_all_action_items_to_email.[Days to last email]
FROM qry_pplc_all_action_items_to_email
WHERE (((qry_pplc_all_action_items_to_email.[Days to Orig Due Date]) Between [Forms]![frm_pplc_email_ais]![orig_due_From] And [Forms]![frm_pplc_email_ais]![orig_due_to]));


Days to Orig Due Date is calculated.

orig_due_From and orig_due_to are text boxes.

Here is the sql that calculates the date field(s):
SELECT tbl_product_PPL_Court_Followup_LIs.pplc_AI_Key, Max(tbl_product_PPL_Court_Followup_LIs.email_date) AS MaxOfemail_date, Max(tbl_product_PPL_Court_Followup_LIs.follow_up_date) AS MaxOffollow_up_date, Max(tbl_product_PPL_Court_Followup_LIs.rsvd_due_date) AS MaxOfrsvd_due_date
FROM tbl_product_PPL_Court_Followup_LIs
GROUP BY tbl_product_PPL_Court_Followup_LIs.pplc_AI_Key;



for info purposes - maxoffollow_up_date is Days to Orig Due Date on the top query.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 39742466
SELECT qry_pplc_all_action_items_to_email.Item_Status
           , qry_pplc_all_action_items_to_email.PPLCREV
           , qry_pplc_all_action_items_to_email.[Product ID]
           , qry_pplc_all_action_items_to_email.[Product Action Items]
           , qry_pplc_all_action_items_to_email.Resolution
           , qry_pplc_all_action_items_to_email.[Resolve Date]
           , qry_pplc_all_action_items_to_email.AI_Owner
           , qry_pplc_all_action_items_to_email.AI_Owner_email
           , qry_pplc_all_action_items_to_email.[Product Name]
           , qry_pplc_all_action_items_to_email.[Days to Orig Due Date]
           , qry_pplc_all_action_items_to_email.[Days to Revised Date]
           , qry_pplc_all_action_items_to_email.[Days to last email]
FROM qry_pplc_all_action_items_to_email
WHERE qry_pplc_all_action_items_to_email.[Days to Orig Due Date]
Between [Forms]![frm_pplc_email_ais]![orig_due_From]
And [Forms]![frm_pplc_email_ais]![orig_due_to]

Have you defined these parameters for the query?  Chances are that it may be interpreting those form control values as text, not numbers.  You can create the parameters by right clicking in the top of the query design grid and selecting parameters.parametersThen copy your parameters:

[Forms]![frm_pplc_email_ais]![orig_due_From]
[Forms]![frm_pplc_email_ais]![orig_due_to]

to two successive lines (the top two) and select the data types.  Then open your form, enter your parameters and rerun the query.
0
 

Author Closing Comment

by:jwandmrsquared
ID: 39742505
I also had to set the text boxes to format Fixed, but the parameters finished it off.  The minute you said it, the dust fell off my brain.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39742601
Glad I could help
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question