CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Sending MS Access query parameters

    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.


  2. #2
    Join Date
    May 1999
    Location
    Houston - TX - US
    Posts
    29

    Re: Sending MS Access query parameters

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured