Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2004
    Posts
    31

    Red face Unanswered: Calendar on Access

    Hello! Almost home time now so probs last post for today! (Hoorah I hear you all say!)

    I need to be able to put people's leave/sickness on an Access form and have put the calendar control calendar on the form. Is this an ok way to do this if I need days to go a certain colour on a dbl click if a person is absent/sick? Anybody know any commands for this?

    Ta muchly!

    PS I need every record in the form to be able to click the calendar and mark their own leave etc. And no, I really don't get paid enough to do this - if they paid a proper computer person perhaps I wouldn't spend all day on forums like this!

    Huh huh huh??!??!?
    Last edited by raepepper; 06-15-04 at 11:44.

  2. #2
    Join Date
    Jun 2004
    Posts
    31
    any ideas? I know there aren't many people here but if anyone knows...

  3. #3
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    Quote Originally Posted by raepepper
    any ideas? I know there aren't many people here but if anyone knows...
    I don't knows if this helps but I don't even attempt to use the Access calendar.

    I use a query with two fields. One field has from 0 to 365 entered and the other is a calculated field that is DateField:[Number]+Date(). That gives a rolling 12 months. You can also enter minus numbers like -365 through to 365.

    A tabular form is based on the query and I have a macro open the form starting at the current date. I actually have two fields that create the date and they exactly overlay each other and they have transparent backgrounds. One has green forecolour and the other is red. When you click on the date a Setvalue actions makes and entry which causes one to be null and hence the colour appears to change. I have the two overlaying fields based on an IIF

    For me there are two pluses over the Access type calendar. One is that I can rapidy scroll through months. The other is that because it is a standard from I can do whatever I like with macros where as I am lost with the Access type calendar.

    I forgot to add, the form is a pop up and it lines up when opened to exactly cover about 2 inches or so of the right hand side of the form. The form also has a combo at the top for inserting time.

    Mike
    Last edited by Mike375; 06-15-04 at 12:20.

  4. #4
    Join Date
    Jun 2004
    Posts
    31
    Ta muchly!

    It seems like a good idea, and I understand most of it, but how on earth do you make a two col query without linking it to a prior table?

    Otherwise, yep I will give that a go - would I be able to do it in a table? And does this method ensure that false dates eg 31 Feb cannot be selected?

    Thanks tho, will start having a go tonight and feed back.

  5. #5
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    The query is based on a table.

    To enter the numbers this what I do:

    Enter 1 record with a 0.

    I then havea macro that has the following actions:

    Do to next record
    A SetValue that sets the value of the field at 1
    GoToControl the field name
    DoMenuItem Paste (I think this is DoCmd in later versions of Access
    DoMenuItem SaveRecord
    SetValue [YourField] set to [ourField]+1
    GoToControl the field name
    DoMenuItem Copy

    I then make another macro that has a RunMacro action only and the macro is the above macro. For the repeat count I put in the number of days I want

    make a simply tabular form and place the macro on a lable for OnClick

    Open the form and the one record with 0 will be there. Copy the 0 and then run the macro and watch it scream down the page with Echo set to Yes

    If you wanted to be able to scroll bacl through a year and scroll forwsard a year then make the number for the first record -365 and set the repeat count at 730

    Feb 28/31 is no problem because it is all based on Date() which is the current date.

    Just fremember that in this format it is only for clicking on a date and then having that date stuck into a field on another form. It is no good for putting information on itself that relates to the date because the date on each row changes each day because the date is a product of [YourField]+Date() and of course Date() gets bigger by 1 day each day.

    To do that you make your query a maketable query and then base the form on the nedw table.

    Mike

  6. #6
    Join Date
    Jun 2004
    Posts
    31

    Angry What is wrong with this macro?

    Hello,

    Thanks for your help so far Mike, I finally had some time to go thru what you said this weekend. But unfortunately I am having a prob with the rolling of the numbers. I can get them rolling up to 365, but they roll on the same record rather than using new records each time. Thats probs cos of using Goto instead of next record but I am using 97 and next seems to create errors and not let the numbers roll to 365. I have attached a doc of the macro details and was wonder if anybody can help clear it up?

    Its probs something really simple that i am doing wrong but i am pretty annoyed with it now!

    Here it is:
    GotoRecord
    Action Arguments
    Object Type: Form
    Object Name: frmCalendar
    Record: Go To (next does not work and I don’t know why!)
    Offset: =1 (or =+1)

    Set Value
    Action Argument
    Item: Record’s name ([form][frmcalendar][day]
    Expression: [Day]=1

    GoToControl
    Action Arg
    Control Name: Day

    RunCommand
    Action Arg
    Command: Paste

    RunCommand
    Action Arg
    Command: SaveRecord

    SetValue
    Action Arg
    Item: Record’s Name
    Expression: [Day]+1

    GoToControl
    Action Arg
    Control Name: Day

    RunCommand:
    Action Arg
    Command: Copy
    Last edited by raepepper; 06-20-04 at 14:35.

  7. #7
    Join Date
    Apr 2004
    Location
    Sydney Australia
    Posts
    369
    I just made you one and have attached it.

    Iuf thios Zipping thisng does not work then I can email what I made as it is 118KB.

    This is in Access 95. The best thinng to do is to import this in an .mdb file you have made in A97

    I have set the macro to run 730 times but you only need to change the number. I have also entered 0 in the first record. If you change that to -365 then you will get from 12 months behind and 12 months out.

    If you fiddle about with make suren when you open the form you have one record there as that gets focus when it opens and the first action line in the macro is Copy

    Mike
    Attached Files Attached Files

Posting Permissions

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