Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / ActiveX Controls / January 2005

Tip: Looking for answers? Try searching our database.

cached data in ActiveX control in multi-user environment

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christopher Glaeser - 05 Jan 2005 05:01 GMT
I have read/skimmed several Access texts including Balter's Access 2003 and
watched many of the AppDev Access tutorials.  I probably missed it, but I
don't know where this topic is covered.  Any suggestions pointing me in the
right direction will be greatly appreciated.

I am adding a DBI Tech ActiveX control to my Access project (ctMDay calendar
control displays scheduled tasks graphically).  It does not support data
binding.  I have implemented the code that copies all the relevant Access
table fields (dates, times, task descriptions) to ctMDay, and they display
correctly.  Looks great.  I have not yet implemented the code to copy the
information from the control back to the Access table after any edits, but I
think I can learn that with a bit more reading.

The part I'm grappling with is the multi-user environment.  The ActiveX
control has a copy of some of the database.  Multiple users can change
dates, times, tasks, etc using either the ActiveX control and/or database
forms.  How do I manage this cached information in the ActiveX control so
that everyone sees the same schedule information?  Is there a small example
or tutorial somewhere that illustrates this concept and implementation?

Best,
Christopher
Alex Dybenko - 05 Jan 2005 08:57 GMT
Hi Christopher,
as i understand you - following solution can be implemented. in tasks table
you can add a new field where your store date/time of record update. on a
form with ctMDay at form timer event you check every say 2 mins if any
changes occured, if yes - then repopulate ctMDay

HTH
Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

>I have read/skimmed several Access texts including Balter's Access 2003 and
>watched many of the AppDev Access tutorials.  I probably missed it, but I
[quoted text clipped - 19 lines]
> Best,
> Christopher
Christopher Glaeser - 05 Jan 2005 13:24 GMT
Hi Alex,

Many thanks for responding.

> as i understand you - following solution can be implemented. in tasks
> table

Yes, the basic info is:

tblTasks [TaskID, ScheduleDate, StartTime, StopTime, Description]

> you can add a new field where your store date/time of record update.

Yes, and this info can be added/edited/deleted via both normal Access forms
and Access form with the ActiveX control.

> on a form with ctMDay at form timer event you check every say 2 mins if
> any changes occured, if yes - then repopulate ctMDay

OK, sounds good.  I see two form properties "On Timer" and "Timer Interval".
So, to make sure the displayed data is accurate, every couple of minutes, I
check to see if anything has changed (a table dirty property?) and then
redraw the calendar if necessary.

Next, about record locks to avoid race conditions.  Suppose a user wants to
drag a task to a new data/time using the ActiveX control.  I think the steps
are something like the following.

- attempt to lock the record
- if the lock fails, then abort the drag-and-drop with a message that the
record is locked
- if the lock succeeds, then upate the record, then release the lock

Am I on the right track?  If so, two quick questions.

- What is the ADODB code snippet to lock and unlock a record?
- The ActiveX control includes many events which I assume are more or less
industry standard.  At what time do I abort a failed drag-and-drop?  Do I
let them do the drag-and-drop, and then move it back if unsuccessful, or
should I abort the drag-and-drop before it actually begins to move?

Best,
Christopher
Alex Dybenko - 05 Jan 2005 16:03 GMT
Hi Christopher,

>> you can add a new field where your store date/time of record update.

> OK, sounds good.  I see two form properties "On Timer" and "Timer
> Interval". So, to make sure the displayed data is accurate, every couple
> of minutes, I check to see if anything has changed (a table dirty
> property?) and then redraw the calendar if necessary.

what i suggest is to save date/time of record update, so getting Max() of
this field you will know if any data changed

> Next, about record locks to avoid race conditions.  Suppose a user wants
> to drag a task to a new data/time using the ActiveX control.  I think the
[quoted text clipped - 6 lines]
>
> Am I on the right track?  If so, two quick questions.

yes

> - What is the ADODB code snippet to lock and unlock a record?

you can open recordset with locked option, see online help for proper
constant name

> - The ActiveX control includes many events which I assume are more or less
> industry standard.  At what time do I abort a failed drag-and-drop?  Do I
> let them do the drag-and-drop, and then move it back if unsuccessful, or
> should I abort the drag-and-drop before it actually begins to move?

i am not so familiar with ctMDay, but i think it should be Cancel argument
in one of D&D events, which you can use

Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

Christopher Glaeser - 05 Jan 2005 19:01 GMT
> what i suggest is to save date/time of record update, so getting Max() of
> this field you will know if any data changed

Good idea.  I was planning to add record-level date/time update info to all
my major tables anyway.  (It's nice to know that someone modified an Invoice
or WorkOrder months after it was created).  Is there a modular way to do
this, or do I just add a couple lines of code to each "After Update" event
of affected forms?

> i am not so familiar with ctMDay, but i think it should be Cancel argument
> in one of D&D events, which you can use

Yes, I see the following Cancel methods.

- CancelDrop: Prevents an appointment from being dropped into a new time or
column.
- CancelSelect: Prevents an appointment from being selected.

CancelDrop should do the trick.  There are quite a few events associated
with the control so now I'll have to read through them and determine which
one(s) to trigger on.  This one looks promising ...

- AppPreDrop: Occurs just before an appointment is either created, or
dropped (with the mouse) into a new column or start time.

Thanks again for your assistance.  This project is starting to look quite
nice.

Best,
Christopher
Alex Dybenko - 05 Jan 2005 20:51 GMT
Hi Christopher,

> Good idea.  I was planning to add record-level date/time update info to
> all my major tables anyway.  (It's nice to know that someone modified an
> Invoice or WorkOrder months after it was created).  Is there a modular way
> to do this, or do I just add a couple lines of code to each "After Update"
> event of affected forms?

normally, when you have a bound form to this table you just use beforeupdate
event to assign textbox control, bound to "LastUpdated" field to date():

me!LastUpdated=date()

HTH
Signature

Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.