invalid where clause 
Author Message
 invalid where clause

I am getting the following run time error on an CRecordset
Open call:

''is not a valid name. Make sure that it does not include
invalid characters or punctuation and that it is not too
long.

I am querying on 3 Access tables with a filter defined as:
m_Report.m_strFilter="plotdate between #3/1/2002# and
#3/15/2002 and Queue=QueueName and Plotters.PlotterID =
Queues.PlotterID and PlotterName=?";

The parameter value is defined as:
m_Report.m_strQueueParam=plotterType;

where plotterType is a CString value coming from a dialog
box. However, I get the same error when I hardcode a value
for PlotterName, too. (e.g. "PlotterName='Xerox 8830'")

In case it matters, the the pertinent part of the resource
file for that CRecordset is:
        //{{AFX_FIELD(CReportsSet, CRecordset)
        CString m_Queue;
        CString m_Division;
        int     m_NumPlots;
        CTime   m_PlotDate;
        CString m_UserName;
        CString m_ComputerName;
        double  m_PaperLength;
        BOOL    m_Color;
        CString m_Media;
        CString m_QueueName;
        long    m_PlotterIDQ;
        long    m_PlotterIDP;
        CString m_PlotterName;
        //}}AFX_FIELD
        CString m_strQueueParam;

and the .cpp file looks like:
CReportsSet::CReportsSet(CDatabase* pdb)
        : CRecordset(pdb)
{
//{{AFX_FIELD_INIT(CReportsSet)
m_Queue = _T("");
m_Division = _T("");
m_NumPlots = 0;
m_UserName = _T("");
m_ComputerName = _T("");
m_PaperLength = 0.0;
m_Color = FALSE;
m_Media = _T("");
m_QueueName = _T("");
m_PlotterIDQ = 0;
m_PlotterIDP = 0;
m_PlotterName = _T("");
m_nFields = 13;
//}}AFX_FIELD_INIT
m_nDefaultType = snapshot;
m_nParams=1;
m_strQueueParam="";

Quote:
}

void CReportsSet::DoFieldExchange(CFieldExchange* pFX)
{
//{{AFX_FIELD_MAP(CReportsSet)
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[Queue]"), m_Queue);
RFX_Text(pFX, _T("[Division]"), m_Division);
RFX_Int(pFX, _T("[NumPlots]"), m_NumPlots);
RFX_Date(pFX, _T("[PlotDate]"), m_PlotDate);
RFX_Text(pFX, _T("[UserName]"), m_UserName);
RFX_Text(pFX, _T("[ComputerName]"), m_ComputerName);
RFX_Double(pFX, _T("[PaperLength]"), m_PaperLength);
RFX_Bool(pFX, _T("[Color]"), m_Color);
RFX_Text(pFX, _T("[Media]"), m_Media);
RFX_Text(pFX, _T("[QueueName]"), m_QueueName);
RFX_Long(pFX, _T("[Queues.PlotterID]"), m_PlotterIDQ);
RFX_Long(pFX, _T("[Plotters.PlotterID]"), m_PlotterIDP);
RFX_Text(pFX, _T("[PlotterName]"), m_PlotterName);
//}}AFX_FIELD_MAP
pFX->SetFieldType( CFieldExchange::param);
RFX_Text(pFX,"QueueParam",m_strQueueParam);

Quote:
}

Sorry this is so long winded but I don't know how much
information you need to figure out the source of this
error.

Any help is appreciated.
Thanks,
Stephanie



Tue, 12 Oct 2004 22:54:40 GMT  
 invalid where clause
Stephanie

Can you show the SQL Select statement for the recordset?

I am particularly interested in how the Queue=QueueName  works.  I am
assuming that QueueName is a field of the query, but where does Queue come
from?  Should it be a literal, perhaps?

all the best
Roy Fine


Quote:
> I am getting the following run time error on an CRecordset
> Open call:

> ''is not a valid name. Make sure that it does not include
> invalid characters or punctuation and that it is not too
> long.

> I am querying on 3 Access tables with a filter defined as:
> m_Report.m_strFilter="plotdate between #3/1/2002# and
> #3/15/2002 and Queue=QueueName and Plotters.PlotterID =
> Queues.PlotterID and PlotterName=?";

> The parameter value is defined as:
> m_Report.m_strQueueParam=plotterType;

> where plotterType is a CString value coming from a dialog
> box. However, I get the same error when I hardcode a value
> for PlotterName, too. (e.g. "PlotterName='Xerox 8830'")

> In case it matters, the the pertinent part of the resource
> file for that CRecordset is:
> //{{AFX_FIELD(CReportsSet, CRecordset)
> CString m_Queue;
> CString m_Division;
> int m_NumPlots;
> CTime m_PlotDate;
> CString m_UserName;
> CString m_ComputerName;
> double m_PaperLength;
> BOOL m_Color;
> CString m_Media;
> CString m_QueueName;
> long m_PlotterIDQ;
> long m_PlotterIDP;
> CString m_PlotterName;
> //}}AFX_FIELD
> CString m_strQueueParam;

> and the .cpp file looks like:
> CReportsSet::CReportsSet(CDatabase* pdb)
> : CRecordset(pdb)
> {
> //{{AFX_FIELD_INIT(CReportsSet)
> m_Queue = _T("");
> m_Division = _T("");
> m_NumPlots = 0;
> m_UserName = _T("");
> m_ComputerName = _T("");
> m_PaperLength = 0.0;
> m_Color = FALSE;
> m_Media = _T("");
> m_QueueName = _T("");
> m_PlotterIDQ = 0;
> m_PlotterIDP = 0;
> m_PlotterName = _T("");
> m_nFields = 13;
> //}}AFX_FIELD_INIT
> m_nDefaultType = snapshot;
> m_nParams=1;
> m_strQueueParam="";
> }

> void CReportsSet::DoFieldExchange(CFieldExchange* pFX)
> {
> //{{AFX_FIELD_MAP(CReportsSet)
> pFX->SetFieldType(CFieldExchange::outputColumn);
> RFX_Text(pFX, _T("[Queue]"), m_Queue);
> RFX_Text(pFX, _T("[Division]"), m_Division);
> RFX_Int(pFX, _T("[NumPlots]"), m_NumPlots);
> RFX_Date(pFX, _T("[PlotDate]"), m_PlotDate);
> RFX_Text(pFX, _T("[UserName]"), m_UserName);
> RFX_Text(pFX, _T("[ComputerName]"), m_ComputerName);
> RFX_Double(pFX, _T("[PaperLength]"), m_PaperLength);
> RFX_Bool(pFX, _T("[Color]"), m_Color);
> RFX_Text(pFX, _T("[Media]"), m_Media);
> RFX_Text(pFX, _T("[QueueName]"), m_QueueName);
> RFX_Long(pFX, _T("[Queues.PlotterID]"), m_PlotterIDQ);
> RFX_Long(pFX, _T("[Plotters.PlotterID]"), m_PlotterIDP);
> RFX_Text(pFX, _T("[PlotterName]"), m_PlotterName);
> //}}AFX_FIELD_MAP
> pFX->SetFieldType( CFieldExchange::param);
> RFX_Text(pFX,"QueueParam",m_strQueueParam);
> }

> Sorry this is so long winded but I don't know how much
> information you need to figure out the source of this
> error.

> Any help is appreciated.
> Thanks,
> Stephanie



Tue, 12 Oct 2004 23:54:59 GMT  
 invalid where clause
Queue is a character string column from the Queues table
and QueueName is another character string column from the
Plot_Accounting table.
The dialog box allows users to select the plotdate range
and the value for the PlotterName column which is in the
3rd table called Plotters. A subset of the relationships
looks like:

Plotters       Queues         Plot_Accounting
--------       ------         ---------------
PlotterName
PlotterID      PlotterID
               Queue          QueueName
               ...            Plotdate
                              ...

The Open function is:
m_Report.Open
(CRecordset::snapshot,"Plot_Accounting,Queues,Plotters",CRe
cordset::readOnly)

Does this make sense?
Stephanie

Quote:
>-----Original Message-----
>Stephanie

>Can you show the SQL Select statement for the recordset?

>I am particularly interested in how the Queue=QueueName  
works.  I am
>assuming that QueueName is a field of the query, but

where does Queue come
Quote:
>from?  Should it be a literal, perhaps?

>all the best
>Roy Fine


message

>> I am getting the following run time error on an
CRecordset
>> Open call:

>> ''is not a valid name. Make sure that it does not
include
>> invalid characters or punctuation and that it is not too
>> long.

>> I am querying on 3 Access tables with a filter defined
as:
>> m_Report.m_strFilter="plotdate between #3/1/2002# and
>> #3/15/2002 and Queue=QueueName and Plotters.PlotterID =
>> Queues.PlotterID and PlotterName=?";

>> The parameter value is defined as:
>> m_Report.m_strQueueParam=plotterType;

>> where plotterType is a CString value coming from a
dialog
>> box. However, I get the same error when I hardcode a
value
>> for PlotterName, too. (e.g. "PlotterName='Xerox 8830'")

>> In case it matters, the the pertinent part of the
resource
>> file for that CRecordset is:
>> //{{AFX_FIELD(CReportsSet, CRecordset)
>> CString m_Queue;
>> CString m_Division;
>> int m_NumPlots;
>> CTime m_PlotDate;
>> CString m_UserName;
>> CString m_ComputerName;
>> double m_PaperLength;
>> BOOL m_Color;
>> CString m_Media;
>> CString m_QueueName;
>> long m_PlotterIDQ;
>> long m_PlotterIDP;
>> CString m_PlotterName;
>> //}}AFX_FIELD
>> CString m_strQueueParam;

>> and the .cpp file looks like:
>> CReportsSet::CReportsSet(CDatabase* pdb)
>> : CRecordset(pdb)
>> {
>> //{{AFX_FIELD_INIT(CReportsSet)
>> m_Queue = _T("");
>> m_Division = _T("");
>> m_NumPlots = 0;
>> m_UserName = _T("");
>> m_ComputerName = _T("");
>> m_PaperLength = 0.0;
>> m_Color = FALSE;
>> m_Media = _T("");
>> m_QueueName = _T("");
>> m_PlotterIDQ = 0;
>> m_PlotterIDP = 0;
>> m_PlotterName = _T("");
>> m_nFields = 13;
>> //}}AFX_FIELD_INIT
>> m_nDefaultType = snapshot;
>> m_nParams=1;
>> m_strQueueParam="";
>> }

>> void CReportsSet::DoFieldExchange(CFieldExchange* pFX)
>> {
>> //{{AFX_FIELD_MAP(CReportsSet)
>> pFX->SetFieldType(CFieldExchange::outputColumn);
>> RFX_Text(pFX, _T("[Queue]"), m_Queue);
>> RFX_Text(pFX, _T("[Division]"), m_Division);
>> RFX_Int(pFX, _T("[NumPlots]"), m_NumPlots);
>> RFX_Date(pFX, _T("[PlotDate]"), m_PlotDate);
>> RFX_Text(pFX, _T("[UserName]"), m_UserName);
>> RFX_Text(pFX, _T("[ComputerName]"), m_ComputerName);
>> RFX_Double(pFX, _T("[PaperLength]"), m_PaperLength);
>> RFX_Bool(pFX, _T("[Color]"), m_Color);
>> RFX_Text(pFX, _T("[Media]"), m_Media);
>> RFX_Text(pFX, _T("[QueueName]"), m_QueueName);
>> RFX_Long(pFX, _T("[Queues.PlotterID]"), m_PlotterIDQ);
>> RFX_Long(pFX, _T("[Plotters.PlotterID]"), m_PlotterIDP);
>> RFX_Text(pFX, _T("[PlotterName]"), m_PlotterName);
>> //}}AFX_FIELD_MAP
>> pFX->SetFieldType( CFieldExchange::param);
>> RFX_Text(pFX,"QueueParam",m_strQueueParam);
>> }

>> Sorry this is so long winded but I don't know how much
>> information you need to figure out the source of this
>> error.

>> Any help is appreciated.
>> Thanks,
>> Stephanie

>.



Wed, 13 Oct 2004 00:23:29 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help Understanding Syntax Clauses

2. Large nested if clauses vs. many logical ANDs

3. I have a problem with the catch clauses!

4. Macro with if-else clause

5. Simulate the "PIC" clause in COBOL

6. CRecordset and WHERE clause

7. ODBC/CRecordset: changing sources, from clause

8. WHERE clause in a TRANSFORM

9. Help with creating SQL Select stmt with a WHERE clause on a Dat/Time field

10. ODBC + CDaorecordset + FindFirst (or SELECT FROM .. WHERE clause)

11. Syntax Error in Constraint Clause

12. ODBC Parametrized queries problem : parameter in where clause that can be NULL

 

 
Powered by phpBB® Forum Software