Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171

    How to filter last Issued date in orders

    Hi friends,
    I created one database for orders.there are too many orders for same department and location with different order numbers and issued date.
    I put one field there in Report for Last issued date.
    So I want that when i make new order for same department and location it should show me the last issued date of last order?
    Thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    This type of value (data dependent on other data) should not be saved into table. Calculate it when needed. A DMax expression in the textbox could accomplish this.

    However, if you must you can either manually enter the value or run an SQL UPDATE action or after the form is open, use code to set the value of the textbox.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Plz tell me in detail how to do ?
    I don't want to do it manually.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The real trick is figuring out what event to put code in. I use only VBA, not macros.

    Don't know enough about your db to offer details at this time.

    Is thumbnail 3 a report object or is it really a form? Is it opened by the 'Open Report' button? Show the code for this button.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Yes thumbnail 3 is Report object.
    I just made this "Open Report" By command Button Report operation to preview Report.
    The code behind this button is as below:

    Private Sub Command14_Click()
    On Error GoTo Err_Command14_Click

    Dim stDocName As String

    stDocName = "REQUISTION"
    DoCmd.OpenReport stDocName, acPreview

    Exit_Command14_Click:
    Exit Sub

    Err_Command14_Click:
    MsgBox Err.Description
    Resume Exit_Command14_Click

    End Sub

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You say "I put one field there in Report for Last issued date." Is this a textbox bound to a field of the report RecordSource? If yes, what is the table name and field name? Code could be above the OpenReport line, like:
    CurrentDb.Execute "UPDATE tablename(LastIssueDate) VALUES(#" & [OrderDate] & "# WHERE Department='" & Me.Department & "' AND Location='" & Me.Location & "'"


    If it is not a bound textbox then need an expression in the report query or in the textbox that will lookup the last issued date. Is the last issued date the last purchase order for a department and location? Expression like:
    DMax("OrderDate", "Orders", "Department='" & [Department] & "' AND Location='" & [Location] & "'")


    Use your table and field names. The example assumes Department and Location are text values.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    June your this code is working
    DMax("OrderDate", "Orders", "Department='" & [Department] & "' AND Location='" & [Location] & "'")


    But it does not identify the Department and location id but just take the last issue date from orders table.

  8. #8
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    and I want to show the quantity in 01,02,03 format not 1,2,3 .
    what setting for this in properties?
    Thanks

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Where did you put the DMax expression? If in a query, show the SQL statement.

    Format(Quantity, "00")
    The result is a string, not a number.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #10
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    I put the expression in that unbound text box .

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    In the Detail section? Are the fields Department and Location included in the RecordSource?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  12. #12
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Here is record source for Report.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Guess I will have to see db to analyze.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Here is my database.
    Last edited by glen; 09-12-2012 at 07:49 AM.

  15. #15
    glen is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2012
    Posts
    171
    Sorry by mistake I uploaded the old copy of my this database.
    I m trying to save as .mdb my current copy but it give message you cannot save in earlier version.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple Field & date range filter
    By mrkandohi001 in forum Reports
    Replies: 6
    Last Post: 01-18-2012, 03:11 AM
  2. Query/Filter by Date
    By jasonbarnes in forum Reports
    Replies: 6
    Last Post: 01-04-2012, 04:05 PM
  3. Date Range filter in a Duplicate query
    By knickolyed in forum Forms
    Replies: 0
    Last Post: 06-27-2011, 04:56 AM
  4. Filter By Date In Different Fields
    By Douglasrac in forum Queries
    Replies: 13
    Last Post: 03-21-2011, 05:24 PM
  5. Filter by date
    By adsm in forum Forms
    Replies: 3
    Last Post: 08-20-2010, 06:50 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