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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AddCurrentValue() w/ date in C++ causing unhandled exception!?

Status
Not open for further replies.

azool

Programmer
Mar 29, 2001
3
US
I'm using a COleDateTime object to set the value of the variant
that is passed to the
Code:
AddCurrentValue()

I've been able to successfully set string
parameters in the report with an almost identical
function, so it seems to be a problem with how I'm handling the date.
As I step through the program in the Debugger, I can see that the
variant has the correct date stored in it, but
I get an unhandled exception at the the
Code:
AddCurrentValue()
.

_Any_suggestions?
Code:
void CDlgReportView::SetReportDateParameter(long index, CTime Date){
        
        _variant_t vtDate;
        COleDateTime oleDate(Date.GetTime());

        VariantInit (&vtDate);
        vtDate.ChangeType(VT_DATE);
        vtDate.date=DATE(oleDate);

        m_Report->ParameterFields->GetItem(index)->ClearCurrentValueAndRange();

        m_Report->ParameterFields->GetItem(index)->AddCurrentValue(vtDate);

}
 
This error may be coming from CR if the data type you are passing doesn't match the data type of the parameter field in the report. Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top