views:

387

answers:

2

A datetime control on a form, bound to a table field, works fine.
If I add the picker inside a tab control it raises this error when I load the form:

An error occured in a call to the Windows Date and Timer Picker control.

Is any workaround for this problem?

+1  A: 

if you are initializing the value of the DTPicker and it's not visible you'll get that error:

// a shortcut to get it visible if it's not in the selected tab:

DTPicker.SetFocus
DTPicker.Value = Now
najmeddine
I have various datetime pickers in the tabs. I don't want to set the focus/value one-by-one through code. Well, I can enumerate the datetime controls dynamically with a simple loop, but still it's not elegant.
Nick D
najmeddine
Ms Access 2003 has many bugs, unfortunately :-/ Anyway, at least now I know why it doesn't work.
Nick D
A2003 doesn't have very many bugs at all. The problem here is that you're depending on an outside component that simply isn't well-integrated into Access. It has been that way for as long as I've been using Access, which goes back to 1996. Use methods entirely native to the default Access setup and you'll be fine. Try using outside components and you'll run into problems.
David-W-Fenton
@David W. Fenton: "A2003 doesn't have very many bugs at all" -- obviously you are discounting the engine ;) I love this quote from Allen Browne's tips: If you use queries [SQM DML], be aware! These can all fail: PARAMETERS clause; SELECT clause; DISTINCT predicate; FROM clause; WHERE clause; GROUP BY clause; ORDER BY clause;" [http://allenbrowne.com/tips.html] -- erm, doesn't leave much that is bug-free ;)
onedaywhen
+1  A: 

See the Calendar Tips page at my website

There could, likely will, be lots of version problems when you go to distribute the MSCal.OCX..

One alternative is MonthCalendar is a completely API generated Month Calendar derived directly from the Common Control DLL. There are links to several downloadable calendar forms at my website. As these are forms you can also do anything with them you want.

You can also use the calendar form which comes in the Access Developers Handbook by Litwin/Getz/Gilbert, publisher Sybex www.developershandbook.com. These books are well worth spending money. Every time I open one I save the price of the book.

Tony Toews
I replaced dtpickers with edit boxes and buttons to pop up a calendar for input. I don't have much experience with Ms Access and your site is a very good guide. Thanks. (I also checked out your blog :-)
Nick D
Good luck with Access. Thanks for the kind words about my website. The format of the website sucks but then I started it back in about 1996 using Notepad as the editor. Too busy to go back and do a complete redesign which it desperately needs.
Tony Toews
My website, http://dfenton.com/DFA/ is almost identical in layout and color scheme to what I put up in 1996 at http://bway.net/~dfassoc/. Compare http://web.archive.org/web/19980204015220/http://www.bway.net/~dfassoc/ to http://dfenton.com/DFA/ and you'll see! Scary!
David-W-Fenton