Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 34
  1. #16
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    Option Compare Database
    Option Explicit

    Public Function pastdue(ByRef dtVal As Date) As String

    Select Case DateDiff("d", dtVal, Date)

    Case Is < 30


    pastdue = "Current"
    Case 31 To 60
    pastdue = "30 Days"
    Case 61 To 90
    pastdue = "60 days"
    Case Else
    pastdue = "Over 90 days"

    End Select

    End Function

  2. #17
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    I've tried using a few different expressions that I came across, like:


    DateValue(CStr(Now()))
    Date()
    =Date()
    Now()
    Date =Now()

    ...and others in the code, but none of it worked.

  3. #18
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    I bound your form1 to the service table and added a textbox bound to the Date field (bad name, as it can be confused with the Date() function). This appears to work in the textbox:

    =pastdue([date])
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #19
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    Hey Paul, I'm sorry to sound stupid, but... what? I have a blank form, "Form1". The form is bound to the "SERVICE" table. A text box is added and bound to the "Date" field of said "SERVICE" table. Now your saying to add another text box, and in the "On Click" property box, place "=pastdue([date])" in the VBA? Is that added to the rest of the VBA code that I have been using? And, if so, where do I place it?

    Sorry man... this is hard stuff for a mechanic!!! lol

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No, that was the control source. The function remained as is (I think).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    OK, I think we may have strolled a little bit off track here (I really have to get better with Access terminology so I can stop creating all of this extra work for the people trying to help me). Let me recap:

    ...and please let me start by eliminating the word "Form" for this topic. I will be working with a "Report" instead.

    TASK: To be able to view a report of all vehicles that are 30, 60 & 90 days past due for service.

    CURRENT PROCESS: On the databases' navigation page I have a link. That link entitled "Vehicles that are 30, 60 & 90 Days Past Due", when selected, opens the report to show the collective results.

    ISSUE: As of right now, when you select that link (Vehicles that are 30, 60 & 90 Days Past Due), an "Enter Parameters Value" box appears where the end user is required to enter a certain date. Instead, what I would like to see happen is for the report to automatically generate the report from the current date, "today's date" if you would.

    Does that make more sense?

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    There is no such link or report on the sample I have, but a textbox with the same control source should work on a report as well. Just tested on the Service_All report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    Sorry 'bout that! RayMilhon had me create all that.

    Here is an updated database with that info so you can see what the heck I am talking about.

    Vehicles.zip

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Have you tried what I posted? You've still got that funky bracketed non-existent field name in there.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    I honestly haven't tried what you posted because I am pretty confused as to what you meant. Are you talking about putting "=pastdue([date])" somewhere into the 30_60_90 Module?

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    No, as I mentioned in posts 20 and 22, that's the control source of a textbox. See attached.

    Click image for larger version. 

Name:	textbox.jpg 
Views:	3 
Size:	63.6 KB 
ID:	11166
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    WOW!!! It works PERFECTLY!!! Thank you. I guess that I am a visually oriented man, so THANKS for the screenshot!

    If I may, one last question on this report...

    My partner mechanic saw the report as I was running it, and he LOVED it!!! But he asked if there was a way to add the "Alternate ID" name/number between the vehicles number (CUA#) and the status of the vehicle? (The reason is that most of the vehicles with an Alternate ID get serviced every month, while the rest get serviced once every ninety days.) This wouldn't be a problem if the control source "Alternate ID" was a part of the SERVICE table, but it isn't.

    Should I add it into the SERVICE table? Or is there another way to call it into the report?

  13. #28
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Sure, you base the report on a query that joins the two tables together. That lets you include fields from both tables on the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #29
    dgaletar is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2013
    Location
    Washington, DC
    Posts
    85
    OK, back to queries. So, create a query & add both tables; SERVICE & VEHICLES. Add all of the fields from SERVICE & Alternate_ID from VEHICLES, right? Then, base the report off of that query, right?

  15. #30
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    You've got it!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Past Due (30, 60, or 90)
    By claysea in forum Database Design
    Replies: 8
    Last Post: 02-11-2013, 03:22 PM
  2. Commiting changes in past records
    By spleewars in forum Programming
    Replies: 3
    Last Post: 04-17-2012, 08:31 AM
  3. Autocop and past when 2 values are the same
    By FuzzFuzz in forum Access
    Replies: 1
    Last Post: 03-07-2012, 10:52 PM
  4. Reviews Past Due
    By Luke in forum Access
    Replies: 5
    Last Post: 07-19-2011, 10:51 AM
  5. Past Due Query
    By sai_rlaf in forum Queries
    Replies: 4
    Last Post: 07-06-2011, 01:53 PM

Tags for this Thread

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