Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Click on macro for date (2000)

    Hello,

    Is is possible to click on a macro which puts in todays date in a field rather than keep having to type it in?
    I don't want the date to be put in automatically as sometimes when l open the form l will not require todays date to be entered into the form.

    Justin.

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

    Re: Click on macro for date (2000)

    There is a handy keyboard shortcut for entering the current date: Ctrl+; (semicolon)
    Similarly, Shift+Ctrl+; (semicolon) inserts the current time.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    I managed to sort out the date problem.

    This is the input mask l used:

    00-00-00;0;_

    Just thought l would let you know in case other loungers might want to know in the future.

    Is it possible to put the shortcut for the date into a macro as l prefer not to use keyboard shortcuts where possible

    Justin.

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

    Re: Click on macro for date (2000)

    How do you want to run the macro?

  5. #5
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    By simply click on a button in the toolbar. Which when clicked on would put todays date in a required field.

    Justin

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

    Re: Click on macro for date (2000)

    Create a macro as in the attached screenshot (and give it a more meaningful name than I did <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>)
    Open a form in form view, then customize the Form View toolbar.
    Attached Images Attached Images
    • File Type: png x.png (5.4 KB, 0 views)

  7. #7
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    Thanks thats exactly what l want.
    Is is possible to do the same but add 7 days onto the date in question.
    i.e click on a button which would put a date into a field which is 7 days on from now?

    Justin.

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

    Re: Click on macro for date (2000)

    Replace Date() by Date()+7 in the macro, then save it under another name.

  9. #9
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    I tried this but got an error. see attachment.

    Also please could you explain how the following coding works briefly, for furture reference.

    [screen].[activecontrol]
    Date()


    Justin
    Attached Images Attached Images

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

    Re: Click on macro for date (2000)

    Screen.ActiveControl refers to the active control (the selected control, the one with the focus) on the active form. You can't run the macro directly from the database window, because that takes away the focus from the control. You must assign it to a toolbar button and click that.

    Date() is a Visual Basic function that returns the current date.

  11. #11
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    That works fine.

    Altough how do l enable it so that the macro only works on certain field when it is activated.
    Rather than the first field in sees in the form?

    Justin.

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

    Re: Click on macro for date (2000)

    In the design of the macro, you can replace [Screen].[ActiveControl] by the name of the field you want to fill, enclosed in square brackets, e.g. [OrderDate].

    But I'm not sure I understand you correctly - what do you mean by "when it is activated"?

  13. #13
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    I tried this but got an error.
    see attachment.

    Justin.
    Attached Images Attached Images

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

    Re: Click on macro for date (2000)

    Obviously, the macro will only work correctly if you have a form open with a control named "Reminder Sent". If not, you will get the error message.

  15. #15
    5 Star Lounger
    Join Date
    Mar 2004
    Posts
    924
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Click on macro for date (2000)

    The control is called 'Reminder Sent'
    Altough l still appear to be getting error. See attachment.

    Justin.
    Attached Images Attached Images

Page 1 of 2 12 LastLast

Posting Permissions

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