Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening the Access table gives assertion error

Status
Not open for further replies.

PavelGur

Programmer
Sep 21, 2001
75
0
0
I have very strange program behavior. In the process of obtaining date period from Access table I'm getting assertion error and not even on every execution of the code. I have try - catch set but it do not give me exception but stops at the table openning.
Here is the code:
szPrevDate = tLastBrkDate.Format("%m/%d/%y");
szCurDate = tCurDate.Format("%m/%d/%y");
szDates = szDatesSelect
+ szPrevDate
+ szDateLast
+ szCurDate
+ szDateOrder;

try
{
pDATE->Open(CRecordset::snapshot, szDates, CRecordset::none);
}
catch(CDBException* e)
{
CString szFunction("pDate->Open");
HandleError(e, szFunction);
return false;
}

The szDates comes as
"select * from Dates where ((Dates.Date)>#03/03/06#) and (Not Dates.Date>#03/10/06#) order by Date"
The dates are in the table and table is fine. It works most of the time. But once in a while give this strange assertion error.
Did anybody had this problem?
Thanks, Pavel.
 
Please use [code][/code] tags when posting code.

--
 
Thanks, I will from now on.
Pavel.
Here is the code:
Code:
szPrevDate = tLastBrkDate.Format("%m/%d/%y");
szCurDate = tCurDate.Format("%m/%d/%y");
szDates    = szDatesSelect
    +    szPrevDate
    +    szDateLast
    +    szCurDate
    +    szDateOrder;

try
{
pDATE->Open(CRecordset::snapshot, szDates, CRecordset::none);
}
catch(CDBException* e)
{
CString szFunction("pDate->Open");
HandleError(e, szFunction);
return false;
}
 
And what exactly does the assertion error tell you (or indeed tell us if you post it).

Assertions basically denote bugs in the code - here is an example
Code:
double mySquareRoot ( double a ) {
  assert( x >= 0.0 );
  // now we're sure a is positive
}
You're not supposed to call mySquareRoot() with a negative number. If you do, an assertion will be generated.

The text of the assert should give you some idea of what it doesn't like.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top