Results 1 to 4 of 4
  1. #1
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246

    Limit on Date

    Here is my code:



    Code:
    Private Sub cmdShipping_DblClick(Cancel As Integer)
        If Not ValidateShipping() Then
            MsgBoxOKOnly ShippingNotComplete
        Else
            Me![Status ID] = Shipping_CustomerOrder
            
            If IsNull(Me![Shipped Date]) Then
                Me![Shipped Date] = Date
            End If
            eh.TryToSaveRecord
            SetFormState
        End If
    End Sub
    How can I put a limit on how orders to schedule on the per ship date?

    TIA

    Stephanie

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    After you assign the [Shipped Date], in one way or the other, you can check to see if the shipments exceed your limit for a given date with something like this

    Code:
    If DCount("*", "ActualTableName", "[Shipped Date]= #" & Me.[Shipped Date] & "#") > 2 Then
       MsgBox "More than 2 Items Scheduled to Ship on This Date!"
       Exit Sub
    End If


    The sample code will pop the Messagebox if there are 3 or more shipments already scheduled for the given date, and exit the Sub, without carrying out the rest of the code, such as saving the Record. This would allow you to try a new shipping date.

    You can adjust 2 to fit your needs, of course, and replace ActualTableName with the actual name of your Table.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    PERFECT!! and THANK YOU! :-)

    Stephanie

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help, Stephanie!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Possible damage from 2gb limit
    By chrisleng in forum Access
    Replies: 7
    Last Post: 10-15-2012, 06:14 AM
  2. Replies: 1
    Last Post: 03-04-2012, 03:49 PM
  3. Limit to Arguments?
    By ducecoop in forum Access
    Replies: 4
    Last Post: 11-01-2010, 01:52 PM
  4. Partial Limit
    By bglaugh in forum Programming
    Replies: 1
    Last Post: 09-15-2010, 06:49 AM
  5. Limit Records
    By EHittner in forum Forms
    Replies: 1
    Last Post: 05-03-2010, 10:37 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