Hi there. I'm trying to use the "SQLQueryString" Command to reset the sql query in a report I'm creating using the RDC component in a Visual Basic 6 application. I'm having a lot of trouble figuring out the correct syntax that the report is looking to recieve the sql string in. I keep getting an invalid table name error but there isn't an invalid table name in my query. Do I have to send the string to the report with double quotes already built in? Everything I've seen in reference to syntax either shows no quotes or single quotes only. What is the correct way to do it? I'd be grateful for any help with this.
Thanks,
CrystalVisualBOracle
strSelection1 = & _
"SELECT R_PUBN_RPT_LOG.'R_TIMEPERIOD_ID', " & _
"R_PUBN_RPT_LOG.'DATESTAMP', " & _
"R_PUBN_RPT_LOG.'UNIQ_USER', " & _
"R_PUBN_RPT_LOG.'HIT', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE1', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE2', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE3', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE4', " & Chr$(13) & _
" D_SERVER.'COMPANYNAME', " & Chr$(13) & _
" M_PUBLICATION.'DESCRIPTOR', " & Chr$(13) & _
" M_PUBLISHER.'DESCRIPTOR'" & Chr$(13) & _
"FROM 'D2ALLLOGS'.'R_PUBN_RPT_LOG' R_PUBN_RPT_LOG, " & _
"'DISTRIB'.'D_SERVER' D_SERVER, " & _
"'D2MAIN'.'M_PUBLICATION' M_PUBLICATION, " & _
"'D2MAIN'.'M_PUBLISHER' M_PUBLISHER" & Chr$(13) & _
"WHERE R_PUBN_RPT_LOG.'D_SRVR_ID' = D_SERVER.'ID' " & _
"AND R_PUBN_RPT_LOG.'M_PUBN_ID' = M_PUBLICATION.'ID' " & _
"AND M_PUBLICATION.'D_PUBLISHER_ID' = M_PUBLISHER.'ID' " & _
"AND M_PUBLISHER.'ID' = " & strPubrID & " " & _
"AND R_PUBN_RPT_LOG.'DATESTAMP' = DATE ('" & strPbrCrystalDate & "')" & Chr$(13) & Chr$(10) & _
"ORDER BY D_SERVER.'COMPANYNAME' ASC, M_PUBLICATION.'DESCRIPTOR' ASC, R_PUBN_RPT_LOG.'R_TIMEPERIOD_ID' ASC"
Report1.Database.Tables(1).SetLogOnInfo "sv", "sv", "ui", "pwd"
Report1.SQLQueryString = strSelection1
Debug.Print Report1.SQLQueryString
Thanks,
CrystalVisualBOracle
strSelection1 = & _
"SELECT R_PUBN_RPT_LOG.'R_TIMEPERIOD_ID', " & _
"R_PUBN_RPT_LOG.'DATESTAMP', " & _
"R_PUBN_RPT_LOG.'UNIQ_USER', " & _
"R_PUBN_RPT_LOG.'HIT', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE1', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE2', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE3', " & _
"R_PUBN_RPT_LOG.'BAND_RANGE4', " & Chr$(13) & _
" D_SERVER.'COMPANYNAME', " & Chr$(13) & _
" M_PUBLICATION.'DESCRIPTOR', " & Chr$(13) & _
" M_PUBLISHER.'DESCRIPTOR'" & Chr$(13) & _
"FROM 'D2ALLLOGS'.'R_PUBN_RPT_LOG' R_PUBN_RPT_LOG, " & _
"'DISTRIB'.'D_SERVER' D_SERVER, " & _
"'D2MAIN'.'M_PUBLICATION' M_PUBLICATION, " & _
"'D2MAIN'.'M_PUBLISHER' M_PUBLISHER" & Chr$(13) & _
"WHERE R_PUBN_RPT_LOG.'D_SRVR_ID' = D_SERVER.'ID' " & _
"AND R_PUBN_RPT_LOG.'M_PUBN_ID' = M_PUBLICATION.'ID' " & _
"AND M_PUBLICATION.'D_PUBLISHER_ID' = M_PUBLISHER.'ID' " & _
"AND M_PUBLISHER.'ID' = " & strPubrID & " " & _
"AND R_PUBN_RPT_LOG.'DATESTAMP' = DATE ('" & strPbrCrystalDate & "')" & Chr$(13) & Chr$(10) & _
"ORDER BY D_SERVER.'COMPANYNAME' ASC, M_PUBLICATION.'DESCRIPTOR' ASC, R_PUBN_RPT_LOG.'R_TIMEPERIOD_ID' ASC"
Report1.Database.Tables(1).SetLogOnInfo "sv", "sv", "ui", "pwd"
Report1.SQLQueryString = strSelection1
Debug.Print Report1.SQLQueryString