Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 13th, 2005, 07:02 PM
dkidd dkidd is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2005
Posts: 1 dkidd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 8 sec
Reputation Power: 0
Question Returning value using date range

I am having issues with returning a value when a date in one table is between two dates in another table.

Here are the fields of the two tables (simplified to the ones used for this query)
The two tables do no share a relationship based on IDnumber.

Table1:
IDNumber (primary)
AcctNumber
Activation Date

Table2:
IDNumber (primary)
AcctNumber
Date1
Date2
Percentage

I need to return Table2.Percentage when Table1.AcctNumber equals Table2.AcctNumber AND Table1.ActivationDate is BETWEEN Table2.Date1 AND Table2.Date2


On the surface this appears like it should be easy. I feel that I am missing something simple. Does anyone have any suggestions. Should I use VB? SQL?

Please help. Thanks!

Reply With Quote
  #2  
Old May 16th, 2005, 10:52 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
You might be able to use a simple Select Query using the following SQL for the query.

SELECT Table1.AcctNumber, Table2.Percentage
FROM Table1 INNER JOIN Table2 ON Table1.AcctNumber = Table2.AcctNumber
WHERE (((Table1.AcctNumber)=IIf([ActivationDate]>[Date1] And [ActivationDate]<[Date2],[Table1].[AcctNumber])));

This will give you the AcctNumber from Table1 and the corresponding Percentage from Table2

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Returning value using date range


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT