Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008

    Unanswered: All records for this week...


    I'm wondering if there is something I can do that will pull all the records from between now and next week...

    I have tried a few things but I can't figure it out.

    I need to know all the prescriptions that need refilling during the next working week...

    Working with 2007

    Any help would be great

    Thank you

  2. #2
    Join Date
    Oct 2009
    yes sure there is. manually just put in the date range into the query as criteria:

    >=#1/14/10# AND <=#1/22/10#

    there are more sexy ways to auto calc 7 days forward and all that...but this is the baseline method....

  3. #3
    Join Date
    Nov 2009
    if you wanted to do this with coding, the following should work (hopefully):

    When you click a button with the following coding:

    Dim strNextweek as date

    strNextweek = DateAdd("ww",1,Date())

    DoCmd.ApplyFilter , Date()<= [renewalDate] <= strNextweek

    Then after, if you want to take the filter off, use the buttons on the ribbon to turn off filters.

    Again I think this will work, first time of using .Applyfilter
    Last edited by pb190; 01-14-10 at 12:14. Reason: Whoops changed 'Now()' for 'Date()'

  4. #4
    Join Date
    Jan 2008
    That works a treat.. Thank you muchness
    How about this one then...
    Ive been calculating the refill dates as:
    Which then gives me the 1st refill date, then...
    Gives me the second.... etc.

    I need to figure in the amount of refills. (Im just working with 3 right now)
    If the refill amount is 1 or more my query works...
    But is its 0, it still puts out the next 3 refill dates,

    If the refills = 2, I want it to do this...


    If the refills = 3 It does this...

    And if the the refills =0 then no dates should show...

    I bet that was as clear as mud...
    Any help would definitely be appreciated...
    Again I have tried stuff but it is giving me strange dates,,, like -1 or 2.5


  5. #5
    Join Date
    Nov 2009
    Hi I get what you mean, the only question is how are you outputting your results? As this will change the coding.

    Are the results to be recorded in a table? Or shown on the screen in a listbox? or in individual textboxes?

    I am guessing it is a table as you probably then want to use filtering.

    And I am also guessing you have a "New prescription" form or subform?
    And also a "Number of Refills" combo- or textbox.

    If this is true then have a button that lets the user "add the prescription". Then on the button's OnClick event you will need to:

    1. Put error checking in e.g. Make sure they have put a drug into the Drug textbox

    The coding from now is going to be a bit complicated, so I think I'll stop there before I start barking up the wrong tree.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts