Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Get Business Date in VBA

Posted on by 1,615

Hi there,

How do I get the business date (not todays date) using VBA?

Thanks

Jo

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get Business Date in VBA

    I may have to let someone else take a run at this.  I just tried fetching bpes.today under Customization Manager and could not make that work either.  It works fine under the SL toolkit for custom screens but it does appear that bpes is not available at the customization level.  I will continue to play around with this as time permits.

    Sorry.

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Get Business Date in VBA

    I see you are using bpres.today which I couldn't find.  I am using customisation manager.

    As for your date question I am not still in June!  In this country our date format is dd/mm/yyyy

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get Business Date in VBA

    I just tested this under SL 2011 and it worked for me just fine.  I first looked at bpes.today with the business date not changed and it gave me 12/09/2013.  I then changed the business date to 12/04/2013 and looked at bpres.today and it now gave me 12/04/2013.  I did have to close the screen and re-open it after changing the business date because bpes is loaded during the form open event.

    I am running these tests in a project opened in VB.NET as opposed to Customization Manager.

    I am also a bit curious about the dates in your posting.  While I wish it was still June, it is, unfortunately, December in my world.  Also, were you really trying to change the business date to a future date?

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Get Business Date in VBA

    Hi Rick,  I am using SL2011

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get Business Date in VBA

    What version of Dynamics SL are you using.  I tested my response before providing it and it worked fine but I tested in under SL 6.5.

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Get Business Date in VBA

    Hi Rick,

    Bpes.today shows todays date 6/12/13 if I change business date to 8/12/13 and it shows 4/12/13 if I leave business date as todays date (6/12/13).  it seems to show 2 days less than I have changed it to

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get Business Date in VBA

    That is the business date.  The bpes table holds the business date in that field.  Try changing the business date and then look at that field in the table and it will contain the date you just set the business date to.

  • Jo Wykerd Profile Picture
    Jo Wykerd 1,615 on at
    RE: Get Business Date in VBA

    Thanks Rick but I wanted business date which may not necessarily be the same as todays date.

    Any ideas?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get Business Date in VBA

    bpres.Today for the raw date or datetostrsep(bpes.Today) for the text date.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans