Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2007
    Posts
    25

    Unanswered: ActiveX Calendar always behind listbox

    I am in the process of setting up an ActiveX calendar to choose dates using the instructions located at...

    http://www.fontstuff.com/access/acctut09.htm

    I have a listbox (which I haven't setup yet) I just threw it there for placement.

    The ideal place to have this calendar popup would be directly over the listbox. For the most part, it wouldn't be seen. Only when entering the date.

    For some reason the listbox appears always on top of the Calendar. Everything else will show behind the calendar, but the ListBox always shows on top. I have sent the list box to the back. And tried bringing the calendar to the front, but for some reason it will not display that way.

    However, if I move another window over the Calendar, it will then show the calendar, but the Rectangle I put around the Calendar for appearance is still behind the listbox.

    It's strange. To see the effect I'm talking about, see the picture.

    Any thoughts on this? It doesn't absolutely have to be there. I can put it elsewhere. I just fine it strange and wonder if there are some bugs in Access 2k regarding this.

    Thanks for your input,

    RJ

  2. #2
    Join Date
    Dec 2006
    Location
    Momence, IL USA
    Posts
    56
    If the calendar control is going to completely cover the listbox until a date is selected, can you make the listbox.visible = false while the calendar.visible = true?
    Don't Bogart That Squishee!

  3. #3
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by a-dam
    If the calendar control is going to completely cover the listbox until a date is selected, can you make the listbox.visible = false while the calendar.visible = true?
    True. I was wondering more if this was a known bug and if there is a way to fix it.

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Don't use the calendar control?

    http://www.dbforums.com/showpost.php...8&postcount=28

    Just a thought.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Dec 2006
    Location
    Momence, IL USA
    Posts
    56
    It's definitely a bug; don't have to search google for that. Don't know if the bug is in the mscal.ocx or access. If you do an InvalidateRect/UpdateWindow on the calender in the Form_Load, it will appear correctly at first. But then if you get it to repaint a few times, like by covering/uncovering it with another window, the "ghost" of the listbox underneath it will show again. (I've got Access2K and MsCal 9.0) And the thing I said about visible=false is a nightmare in Access with it's "can't hide a control with focus" problem. You also can't position things "off-screen" with something like Control.Top = -3000. Access aint VB!
    It might have been fixed by now. If you get all the updates and service packs and fixes. Trying to find the right patches at the site Microsoft is a lot of fun. Every search and link will try to sell you Office 2007 and/or Vista.
    I'm going to check out that big zip file pkstormy attached.
    You can check out this little snippet I did while experimenting. It has a calendar control on top of a listbox. Click on listbox to add new dates to it.

    Code:
    Option Compare Database
    Option Explicit
    Const lbheight As Long = 2000
    Const calheight As Long = 3000
    Dim liststring As String
    Dim listarray() As String
    
    Private Sub cal_AfterUpdate()
    Dim ub As Long
    ub = UBound(listarray)
    ReDim Preserve listarray(ub + 1)
    listarray(ub + 1) = cal.Value
    liststring = Join(listarray, ";")
    lstDates.RowSource = liststring
    cal.Height = 1
    lstDates.Height = lbheight
    End Sub
    
    Private Sub Form_Load()
    ReDim listarray(1)
    listarray(0) = "1/1/2008"
    listarray(1) = "1/2/2008"
    liststring = Join(listarray, ";")
    lstDates.RowSource = liststring
    lstDates.Height = lbheight
    cal.Height = 1
    End Sub
    
    Private Sub lstDates_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    lstDates.Height = 1
    cal.Height = calheight
    End Sub
    Don't Bogart That Squishee!

  6. #6
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by a-dam
    It's definitely a bug;
    Find another location it is. LOL Too many variable situations this will be used in to guarentee it'll work for everyone.

    Thanks for the input,

    RJ

Posting Permissions

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