Access crashes with calendar control

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Access crashes with calendar control

Post by dasadler »

When I enter data into a date field of a form either with the calendar control or by directly typing it in, Access crashes. The error message I get is:

Problem signature:
Problem Event Name: APPCRASH
Application Name: MSACCESS.EXE
Application Version: 12.0.6423.1000
Application Timestamp: 49b08a47
Fault Module Name: VBE6.DLL
Fault Module Version: 6.5.10.40
Fault Module Timestamp: 48a4b5d6
Exception Code: c0000005
Exception Offset: 001610bb
OS Version: 6.1.7600.2.0.0.768.3
Locale ID: 1033

Additional information about the problem:
LCID: 1033
Brand: Office12Crash
skulcid: 1033

There is the offer to seek a solution online which I always choose and Access closes.

Any idea what the problem is?
Don

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Whatever it was, I seem to have fixed it. There was an after update event associated with the date field as follows (from Hans):

Code: Select all

Private Sub EventDate_AfterUpdate()
' ************
' The code in this sub came directly or indirectly from my
' participation in Woody's Lounge at www.wopr.com
' and probably from Hans V.
' ************
If Me.NewRecord Then
Me.Date_entered = Now
Me.EventNumber = "E" & Trim(Str(Year(Me.[Date_entered]) - 2000)) & Trim(Str(Me.[EVENTID]))
End If
End Sub
The field EventNumber is a text field and I had it designated as a field length of 6 in the table design. I changed it to a length of 10 and the app does not crash. I wonder why, all of a sudden, it was crashing. The next EventID number would have been 92 which would have created a value of E1092 for the EventNumber field. Oddly enough, when I changed that field length and added another record the EventID number was 99 - so there is a number gap in the event table as records go from 90, 91, 99 (EventID field).
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

Is EventID an AutoNumber field? If so, a number assigned to a new record but not actually stored because the user canceled the new record or because Access crashed, will not be reused. Only if you compact and repair the database, the AutoNumber seed should be reset to (highest stored number)+1.
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Yes, EventID is an autonumber field - it is the index. Thanks for the explanation - no need to have contiguous numbers, just seemed odd.
Don

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: Access crashes with calendar control

Post by Wendell »

If that is something you can reproduce in a simple database, you might consider sending in a bug report to Microsoft. Trying to put a text value into field as you are doing should not cause Access to crash, even if you are trying to put a string that is one character too long. Does the problem reoccur if you set the field length back to 6?
Wendell
You can't see the view if you don't climb the mountain!

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

I was wrong - I did not correct the problem. It exists even after I changed the field length- don't know why it worked yesterday. It seemsto work fine until I make an entry in that date field then I notice the cursor does not change back to the 'insert' cursor (looks like an Upper case I); instead it remains as an arrow and as soon as I click into another field, it crashes.
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

I cannot reproduce the error (I'm using Access 2007 SP2). Any chance that you could post a stripped-down, compacted and zipped copy of the database?
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

I will try to do that. However, I recently (two weeks ago) made a copy of the DB and I just opened it and it did not crash even though I entered more records than the 'bad' DB has. As far as I can tell, the only difference is that the 'bad' Db has a text box on the form using EventDate as the control source with plain text format in the form of ddd.

That text box is the result of discussions here: http://eileenslounge.com/viewtopic.php?f=29&t=1550
Don

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Update - I removed that text box and it seems to work now. The purpose of that text box was to simply display the day of the week of the EventDate. Wonder why it causes problems?

Edited to add images.

Here are the properties. I wonder if it has anything to do with EventDate as a control source? Is it because it has to look at the table entry as opposed to merely looking at the form field entry?
You do not have the required permissions to view the files attached to this post.
Last edited by dasadler on 13 Apr 2010, 19:04, edited 1 time in total.
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

Sorry, no idea without seeing the database (and quite possibly not even if I saw it). I have several forms with a similar setup, and they work without problems.
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Please see edited post above with images - does that help?
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

Just grasping at straws now - does it make a difference if you set the Control Source of the text box to EventDate instead of [EventDate]? I don't see any other (significant) difference with the settings in my test database.
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Made no difference. I even tried me.[eventdate] to no avail.
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

Me.[EventDate] is not a valid control source, it is a VBA expression...
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

Here's another idea. Since the EventDate has an after_update event, why couldn't I include something in the code like

Code: Select all

Private Sub EventDate_AfterUpdate()
' ************
' The code in this sub came directly or indirectly from my
' participation in Woody's Lounge at www.wopr.com
' and probably from Hans V.
' ************
If Me.NewRecord Then
Me.Date_entered = Now
Me.EventNumber = "E" & Trim(Str(Year(Me.[Date_entered]) - 2000)) & Trim(Str(Me.[EVENTID]))
End If
Me.text105 = me.eventdate (ddd)
End Sub
I know that Me.text105 = me.eventdate (ddd) is not the correct syntax but I am thinking that if I include the correct code as part of the after update event and remove the control source from the text box it might work.
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

It's worth a try, although I still don't see any reason why the control source would cause Access to crash.

(You shouldn't add any other tags between [code]...[/code] tags, they will be ignored.)
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

Try

Me.text105 = Format(Me.EventDate, "ddd")
Best wishes,
Hans

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

I will try it... thanks for the proper code.
Don

dasadler
5StarLounger
Posts: 889
Joined: 25 Jan 2010, 16:26
Location: Garden Grove, CA 92844 USA

Re: Access crashes with calendar control

Post by dasadler »

That works without crashing but on every record it shows the day of the last date change regardless of record. That would be expected since the text105 has no data source.

But the desire was to have each record display the day as well as the date of the event. Only in the case of a new record was the date (the year) used along with the EventID to create an EventNumber.
Don

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access crashes with calendar control

Post by HansV »

If this is a single form, create an On Current event procedure for the form:

Code: Select all

Private Sub Form_Current()
  Me.text105 = Format(Me.EventDate, "ddd")
End Sub
This will update the text box as you move from record to record.
If it's a continuous form, you're out of luck - unbound controls display the same value in every record in a continuous form.
Best wishes,
Hans