April 22nd, 1999, 12:48 PM
I'm designing a front end for an Access database and I want to print Access reports that are based on Access queries. The queries require a date range and I know how to paas the dates from an Access form but does anyone know how I can do it from a VC++ form? I'm using Dao Recordsets and I'm using automation to print the reports. Actually, I'm using the CAccessReports class from the CodeGuru site, which I think is great, by the way.
Thanks in advance.
yash
April 22nd, 1999, 03:37 PM
Hi,
CString strFromDate , strToDate , strTempBuffer , strDateFormat;
CDaoDatabase dbActivityLog ;
int Digit ;
try
{
dbActivityLog.Open( LogDataBaseFile ) ;
}
catch ( CDaoException * e)
{
AfxMessageBox( e->m_pErrorInfo->m_strDescription ) ;
e->Delete() ;
return ;
}
CDaoRecordset rec_ActivityLogRecord( &dbActivityLog ) ;
COleDateTime
strFromDate.Format("%f" , m_FromDate ) ;//m_FromDate is in VC++ format
strToDate.Format("%f" , m_ToDate ) ;//m_ToDate is in VC++ format too
m_strSQL = "SELECT * FROM ACTIVITYLOG WHERE LOGDATE_TIME >= " + strFromDate +
" AND LOGDATE_TIME <= " + strToDate ;
Hope this helps U .
Good Luck.
Yash.