Call function from form event: arbitrary behavior

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Knut Ole
    New Member
    • Mar 2011
    • 70

    Call function from form event: arbitrary behavior

    hi,

    i have a calendar with drawn arrows, with which to show info about bookings. i have a "refresh" button for the form with the drawings, to repaint the arrows depending on changes in tables. this is working fine.

    however, i also have a datepointer, a textbox with a date, as a reference point for which days to draw into the calendar. hope this makes ok sense. the problem arises when i attempt to call the makeArrows() module (which redraws the calendar) from the _Change() or _AfterUpdate() event of the textbox w the date. it wont refresh.

    the drawing-board is located on a subform in a mainform. the "refresh"-button is located on the mainform (and working perfectly, calling the makeArrows() function). the textbox with date is located on the mainform.

    the end of the makeArrows function (the refresh part) looks like this:
    Code:
        'last working solution to refresh problem....
        strMainForm = "Calendar"
        DoCmd.Close acForm, strMainForm, acSaveYes
        
        DoCmd.OpenForm strMainForm, acNormal
        ctr = "ctrCanvas"
        Forms!Calendar!(ctr).SourceObject = "frmCanvas"
    
        'clean up
        '********
        DoCmd.Echo (True)
        Set RecSetBookings = Nothing
        Set RecSetRooms = Nothing
        
    Exit Function
    
    Error_Handler:
    MsgBox Err.Number & ", " & Err.Description & ", " & Err.Source & ".  bID = " & rcBookID
    
    End Function
    i suspect it perhaps has something to do with makeArrows() closing the mainform and reopening it, while it still hasnt returned to the sub-event of the textbox...? but then it's weird that the command button which simply calls makeArrows does work...

    any ideas?

    additionally, if i put the "call makeArrows" in the Text141_Exit(Ca ncel as Integer), i get a 2585, "this action cant be carried out while processing a form or report event," which kinda makes sense. but why only in _Exit()? and so on...

    any input would be greatly appreciated!
    thanks!
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Well some events are part of a series of events, in which you can't escape out of the sequence.

    Is the datepointer textbox bound or bound?

    Comment

    • Knut Ole
      New Member
      • Mar 2011
      • 70

      #3
      i've now changed it around a bit, but the original textbox was unbound. have now made a tblSys for same purpose. still not working 100%. i'll redo the design later, will check back with working solution.

      thanks!

      Comment

      Working...