Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Auto Date Fill In (2002)

    Hi,

    I have frmSalesDataEntry which is bound to tblImportDataEntry. It is a continous form that the user enters [net_sales] by [service_date] and [store_ID]. The user enters information fo a month at a time. The form is set so that the [store-ID ] is autmatically entered on the after update event of [net_sales]. This works fine. It takes time to enter the date and the ideal would be to have the [service_date] automatically advance to the next day. So, if they had just entered [net_sales] for 6/1/05, when they tab to the next line the date would change to 6/2/05 leaving them to only enter the [net_sales].

    I tried putting an unbound textbox that the user enters the first day of the month and put in the code me.service_date = me.txtdate. That works fine to get the first date started. However I'm absolutely stuck on how to get the next dates. I've tried a variety of things in the after update event of net_sales, but nothing is working.

    Thanks,
    Leesha

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Date Fill In (2002)

    Try the following in the After Update event of the form:

    Private Sub Form_AfterUpdate()
    Me.service_date.DefaultValue = Chr(34) & (Me.service_date + 1) & Chr(34)
    End Sub

    Once there is a start date in service_date, the next record will automatically have the next day filled in.

  3. #3
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Date Fill In (2002)

    WOW! Worked like a charm!

    Thanks a bunch,
    Leesha

  4. #4
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Date Fill In (2002)

    After applying Hans code you maybe able to adapt the following to get you through the weekends

    Rolling dates by pressing "+" or "-"

    Provided by Allen Browne, allen@allenbrowne.com

    http://allenbrowne.com/ser-02.html

    HTH, John

  5. #5
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Date Fill In (2002)

    Hi,

    I'm not sure what you mean by this?

    Thanks,
    Leesha

  6. #6
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Date Fill In (2002)

    Allows you to increment/decrement the date by 1 day with +/- keys

  7. #7
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Date Fill In (2002)

    Hi,

    I've got the concept but am not sure of the approach. I'm assuming you're doing this from the keyboard. It's not working for me whehter I use the cntrl or alt tab and if I don't use I get the sign itself.

    Leesha

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Date Fill In (2002)

    Try this

    <pre>Private Sub service_date_KeyPress(KeyAscii As Integer)

    Select Case KeyAscii
    Case 43 ' Plus key
    KeyAscii = 0
    Screen.ActiveControl = Screen.ActiveControl + 1
    Case 45 ' Minus key
    KeyAscii = 0
    Screen.ActiveControl = Screen.ActiveControl - 1
    End Select

    End Sub
    </pre>


  9. #9
    Silver Lounger
    Join Date
    Jan 2002
    Posts
    1,615
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Auto Date Fill In (2002)

    That is awesome!! Thanks so much. Worked like a charm!

    Leesha

Posting Permissions

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