Results 1 to 5 of 5
  1. #1
    Jacqoli4's Avatar
    Jacqoli4 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Location
    Newcastle, KZN
    Posts
    7

    Query that finds the next upcoming date among multiple date fields


    Good Day,

    I am quite new to access, and hoping for some assistance from anyone willing to help.

    I have two tables, Table A contains registration information and dates whilst Table B contains general information about welders that are being registered, both tables have a common unique field relating one to the other(Stamp #).

    (Table A) contains multiple dates: Registration Date,Renewal 1,Renewal 2,Renewal 3 and Expiry Date(Re registration).These dates are in 6 month intervals.

    (Table B) contains a text-box on which I wish to display the next upcoming date from the dates in Table A, regardless of the date field to which it belongs.

    I would be extremely grateful to anyone who could offer some advice.
    Thank you!

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    The implication from your data structure is that a registration only has a life of 2 years - is this correct?

    basically, it looks like your table design is wrong - you need to investigate normalisation. You have an excel style of storing data (short and wide), not a db style (tall and narrow). Assuming the 2 years is correct then as far as I can see you only need the registration date - the rest is covered by rules, e.g. registrationdate+6months etc

    Because of your structure, you will need a complex formula as follows

    NextDate=switch(renewal1>date(),renewal1,renewal2> date(),renewal2,renewal3>date(),renewal3,expirydat e>date(),expirydate)

  3. #3
    Jacqoli4's Avatar
    Jacqoli4 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Location
    Newcastle, KZN
    Posts
    7
    Thank you so much man it works perfectly, another question, how do I get the data returned by the query you've just helped me with to display in a text-box in a form?

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    put the calculation in the recordsource to your form then bind it to your textbox

  5. #5
    Jacqoli4's Avatar
    Jacqoli4 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Location
    Newcastle, KZN
    Posts
    7
    Thanks a lot, you've been very helpful!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 17
    Last Post: 06-17-2014, 08:07 AM
  2. Replies: 9
    Last Post: 11-25-2013, 04:33 PM
  3. Query for upcoming expiration date
    By jones in forum Queries
    Replies: 2
    Last Post: 05-16-2012, 02:18 AM
  4. Replies: 12
    Last Post: 05-07-2012, 12:41 PM
  5. Date Range Report with Multiple Date Fields
    By StevenCV in forum Reports
    Replies: 13
    Last Post: 02-29-2012, 08:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums