Solved

Updating subforms based on a field on the main form

Posted on 2014-10-31
4
134 Views
Last Modified: 2014-12-04
I have a form that is showing a weekly calendar. It has a few different options to move through calendar dates:

1. Simple forward and backward arrows which move the calendar forward and backward one day.

2. Forward and backward arrows with a terminator bar which move the calendar forward and backward one week.

3. A Today button that moves the calendar to today

4. A text box where the date can be entered to jump to a specific date

Also, the appointments that show in the calendar are colour-coded via conditional formatting depending on some flags in the appointments.

I've attached a sample database. It is almost completely working. If you use any of the arrows or the Today button, it works perfectly. But when you click in the text box for the date and use Access's built-in date picker, I have two small problems:

1. Although it jumps to the right date and displays the right appointments, the colouring (via conditional formatting) doesn't take effect until you click on the form somewhere.

2. Related to that. Access seems to be in a bit of limbo until you click on the form. Even if you click the X to close the form, the first click on the X fires the conditional formatting but it takes a second click on the X to close the form.

If you open the attached example and then open frmDispatchCalendarWeekly and use the "back one week" button, you'll see that it works fine. But if you try to use the date-picker to jump back one week (select 2014/10/24), you'll see what I mean.

Thanks in advance.

James
calendar.accdb
0
Comment
Question by:jrmcanada2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40416335
Not sure...
It seems I could not replicate either of your issues,...

I opened the form and used the date navigation buttons to move to Oct 27-28.
As far as I can tell, the conditional formatting displaying fine. (without ever having to "click on the form")

Note: I opened the db in Access 2013

JeffCoachman
0
 
LVL 30

Accepted Solution

by:
hnasr earned 500 total points
ID: 40416959
Try this:
Open frmDispatchCalendarWeekly_Day subform in design view, set Current event o [Event Procedure].
Modify to this code..
Private Sub Form_Current()
    Me.Painting = False
    Me.Requery
    Me.Painting = True
End Sub

Open in new window

0
 
LVL 30

Expert Comment

by:hnasr
ID: 40417000
Another approach.
StartDate after update event, opens and closes a Modal form.

Private Sub StartDate_AfterUpdate()
    UpdateColumnDates
    DoCmd.OpenForm "Form1", acNormal
    DoCmd.Close acForm, "Form1"
End Sub

Open in new window

calendar-2.accdb
0
 

Author Closing Comment

by:jrmcanada2
ID: 40480739
This works but is very slow.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question