Jim Dettman
jimdettman at verizon.net
Mon Jun 23 16:06:20 CDT 2008
Drew, <<Anywho, back to Access forms. In an Access form, the controls on the form aren't actually windows, instead, everything is actually an 'image' and only the current control is a separate window...which is really crazy, because as you move focus from control to control, Access is literally changing that window and turning the previous control to an image. Go figure.>> The original reason given for this was to conserve resources when running. Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Monday, June 23, 2008 4:13 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Lebans' Calendar Screen I was working on a newer version of the 'minicalendar' form I had built years ago. The new one has a lot of bells and whistles, and one of the features I wanted to put into it was to be able to set it as a subform. The problem I ran into (other then lack of time to work on it), is that one of the 'new' features was that the form was shaped. Had some 'animation' with it too (sliding menus for different functions). That is when I discovered how goofy Access forms are. Windows, in Windows, are very simple creatures. On a typical window, each control is another window, usually of a specific class. There are API calls to deal with special windows, and APIs to deal with generic windows. For example, if you want to read the text of a textbox on a window, you just find it's API, and the text is the 'window text' property, where as the same property for a normal window would be it's caption. You can also programmatically run through the contents of a listbox or combobox this way. (I used that one time in an application where I had to take the contents of a listbox with thousands of entries, and put them in a text file. The Listbox was running in a window of a out of the box application, and I had no programming interface to read it, but thanks to how windows work, I was able to use standard window API's to programmatically read the contents of the listbox). Anywho, back to Access forms. In an Access form, the controls on the form aren't actually windows, instead, everything is actually an 'image' and only the current control is a separate window...which is really crazy, because as you move focus from control to control, Access is literally changing that window and turning the previous control to an image. Go figure. So since that new MiniCalendar was trying to modify itself as a window, and it no longer had true window properties, it wouldn't work as a subform. Ok, did I just type all this out cause I'm bored today? Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters Sent: Monday, June 23, 2008 9:04 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Lebans' Calendar Screen Hello to Everyone! Last week I learned how to use Stephen Lebans' date selection calendar. This is not an ActiveX control, but uses API calls. If you haven't looked at this calendar you should. It's quite versatile and is user-configurable. For my customers' use I often record short tutorial videos. If you'd like to view the video I made for this Calendar, you can go to http://www.promationsystems.com/demo.htm. The link is at the bottom of the page. The video is in WMV format, is about 11 minutes long, and goes through all the features. I also may have 'stumbled' across a way of using this on a subform. Instead of instantiating the class (clsMonthCal) in the form as per the instructions on Lebans' site, I instantiated this in a standard module (thanks to Lambert and Charlotte!). I'm posting the code to do this below: '-------------------------------------- '-- In a form or subform (I have only tried a 1st level subform) Private Sub butGetDates_Click() '-- The End Date is optional but is needed if you want a date range. '-- Pass the complete reference to the date controls so that _ the standard module can write back to them. Call OpenCalendar(Forms("frmMain")("txtStartDate"), Me.hWnd, Forms("frmMain")("txtEndDate")) End Sub '-------------------------------------- '-- In a standard module '-- Get the example .mdb from Lebans' site. _ It contains the class module (clsMonthCal) and 4 standard modules. _ Instructions are on the page for this Calendar. Private mc As clsMonthCal Public Sub OpenCalendar(txtStartDateOnForm As TextBox, lnghwnd As Long, Optional txtEndDateOnForm As TextBox) Dim blnRet As Boolean Dim dteStart As Date Dim dteEnd As Date '-- Create an instance of our Class Set mc = New clsMonthCal '-- Set the hWndForm Property mc.hWndForm = lnghwnd '-- Date fields are typically empty to start with dteStart = Nz(txtStartDateOnForm, 0) dteEnd = 0 '-- Run the calendar. The calendar is modal during this line blnRet = ShowMonthCalendar(mc, dteStart, dteEnd) If blnRet = True Then txtStartDateOnForm = dteStart If Not txtEndDateOnForm Is Nothing Then txtEndDateOnForm = dteEnd End If Else '-- Add any message here if you want to _ inform the user that no date was selected End If End Sub '----------------------------- Perhaps someone will find this to be helpful! Dan -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com