Rabu, 21 Mei 2014

Re: [MS_AccessPros] Access 2013 Crashes when opening a form

 

John-


I suspect DateDiff isn't liking Null values.  Also, you're not providing a "false" value for the last IIf.  Working with date/time values in Access, you can simply subtract one from the other to get the number of days.  You could try simplifying like this:

TimeToCred: IIf(Not IsNull([2ndRecrednDate] - [DateLtrSent]), [2ndRecrednDate] - [DateLtrSent], IIf(Not IsNull([RecredentDate] - [DateLtrSent]), [RecredentDate] - [DateLtrSent], IIf(Not IsNull([InitialCredDate] - [DateLtrSent]), [InitialCredDate] - [DateLtrSent], Null)))


John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On May 21, 2014, at 7:27 PM, jfakes@rocketmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I have a database that when I open a form, the database crashes.  I get an error saying the MS Access has stopped running and it tries to save the data.  This db has been stable for years until a user was upgraded to MS Access 2013, the db works fine in MS Access 2010 so I can't figure out what is the issue.  I've decompiled/compiled, compacted and repaired the db.

 

I removed all the VBA and nothing changed, it still crashed.  So I started removing fields.  When I remove a Time to Credential field (based off a calculated field in the underlying query), the database stops crashing.  I'm sure the code in the query needs to be more elegant, however, why is this causing the db to crash? 

 

Basically the calculation is looking through different dates to see which credentialing date it should use to calculate the time.

 

TimeToCred: IIf(DateDiff("d",[DateLtrSent],[2ndRecrednDate]) Is Not Null,(DateDiff("d",[DateLtrSent],[2ndRecrednDate])),IIf(DateDiff("d",[DateLtrSent],[RecredentDate]) Is Not Null,(DateDiff("d",[DateLtrSent],[RecredentDate])),IIf(DateDiff("d",[DateLtrSent],[InitialCredDate]) Is Not Null,(DateDiff("d",[DateLtrSent],[InitialCredDate])))))

 

Oh and btw, if I pause or open up a report or something else in the db, the form opens fine.

 

Any suggestions?

 

John F


__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

.

__,_._,___

Tidak ada komentar:

Posting Komentar