Solved

Updating subforms based on a field on the main form

Posted on 2014-10-31
4
128 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
  • 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

815 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now