Results 1 to 10 of 10
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191

    Open Outlook/Access Calendar

    Hi Guy,s is there an option to open the outlook calendar in office 2016 ?

    I know there used to be a Calendar in Active x controls in earlier versions but doesn't appear to be one in Office 2016

    Ideally i am wanting to open a calendar if i use an option from a Combo



    one option in my combo is "proposed date"

    When selected, ideally a candar to open to check available dates ?

    Kind Regards

  2. #2
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Hi all, i have done this differently but cant work out how to keep adding 1 day by using the right (>) button,

    If I click 3 times, I would like the text box to show Wed-17-Apr-2019 then Thu
    -18-Apr-2019 then Fri
    -19-Apr-2019 etc....

    Below is the > Button code followed by the Screen
    Code:
    Private Sub cmdOneDayMore_Click()
    Dim mDate As Date
    mDate = DateAdd("dd", 1, Date)
    Me.txtPropDate = Format(mDate, "ddd-dd-mmm-yyyy")
    End Sub
    Click image for larger version. 

Name:	Capture2.PNG 
Views:	19 
Size:	2.3 KB 
ID:	38123

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    You must have warnings turned off, or you neglected to post what you're getting. You should be getting "invalid procedure call" or something because you have one too many d's in your dateadd function.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Hi Micron, thank you for your reply, i have managed to get the left to put yesterdays date and the right arrow to put tomorrows date in the textbox by playing around with it

    my question is, when i click the right arrow once, it puts tomorrows date in the text box but click again it wont put the following days date which is what i am looking to do

    So keep clicking and it keeps adding 1 day, hope this makes sense ?

    Code:
    Private Sub cmdOneDayMore_Click()
    Dim mDate As Date, mDate1 As Date
    mDate1 = Format(Now(), "dd/mm/yy")
    mDate = DateAdd("d", 1, mDate1)
    Me.txtPropDate = Format(mDate, "ddd-dd-mmm-yyyy")
    End Sub

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    Date formats are tricky things, often depending on regional settings, whether or not a format is applied at the table level or the control itself. I've removed date formatting from my suggested code as it's presenting an error that I don't have time to troubleshoot, so if you use this, get it working first, then worry about formatting. My problem is likely due to not having your form and date field to interact with. If mDate isn't explicitly a date (as opposed to say, text) that would probably present an issue for me.

    I would have a module level function that accepts +1 or -1 and adds that value to date. Then you can eliminate what would basically be a repeat the same code for each button.

    Code:
    Private Sub cmdOneDayMore_Click()
    Me.txtPropDate = AlterDate(1, Me.txtPropDate)
    
    End Sub
    
    Private Function AlterDate(PlusMinus As Integer, mDate As Date) As Date
    AlterDate = DateAdd("d", PlusMinus, mDate)
    End Function


    Assuming your other event is

    Code:
    Private Sub cmdOneDayLess_Click()
    Me.txtPropDate = AlterDate(-1, Me.txtPropDate)
    End Sub
    You might want to include validation at some level to ensure the date control isn't null/blank, or contains text.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    posting this to trigger emails for updated prior post

  7. #7
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Micron, thank you will be giving this a test soon, appreciated and will come back here to add rating

    Kindest

  8. #8
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Hi Micron, i am recieving error as follows
    Added this to a Module, when this form opens, it does open with the date already in so no text is entered and yes correct for 1 day less

    Code:
    Private Function AlterDate(PlusMinus As Integer, mDate As Date) As Date
    AlterDate = DateAdd("d", PlusMinus, mDate)
    End Function
    
    Added this to > button

    Click image for larger version. 

Name:	Capture3.PNG 
Views:	14 
Size:	12.9 KB 
ID:	38127

  9. #9
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,191
    Does the Private function need to be on the <> buttons or have i done the correct thing by adding to my existying module called Public Functions ?

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    If it's Private, it has to be in the form module for this to work. If you put it in a standard module, the scope of visibility is only to that module if you leave it as Private. To make it visible to other module code when it's in a standard module, it has to be Public.
    Research "ms access variable scope" for more information.

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

Similar Threads

  1. Access - Outlook Appointment shared calendar
    By Guerra67 in forum Access
    Replies: 1
    Last Post: 09-21-2014, 07:26 PM
  2. Populate Outlook calendar with Access Form
    By Artecy in forum Import/Export Data
    Replies: 1
    Last Post: 02-12-2014, 04:51 PM
  3. Populate outlook calendar from access
    By Don T in forum Access
    Replies: 5
    Last Post: 07-13-2013, 12:20 PM
  4. Access to Outlook Calendar
    By GregShah in forum Import/Export Data
    Replies: 1
    Last Post: 02-06-2012, 01:27 PM
  5. Access to Outlook Exchange Calendar
    By avarusbrightfyre in forum Import/Export Data
    Replies: 3
    Last Post: 01-31-2012, 01:49 PM

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