I doubt it is a CString or any value type since it must hold the VALUE NULL
(not NULL as a pointer for the object variable holding the data, but as a
value for the data it represents). It is probably derived from an UNION
allowing you to represent the VB/VBA Variant datatype, but which union
typedef exactly is dependant of the library you use (and it is too long I
used them to relay on my memory to supply more details), but right now, I
think
http://msdn.microsoft.com/en-us/library/ms808313.aspx can help.
Vanderghast, Access MVP
"Landon" <(E-Mail Removed)> wrote in message
news:602E8AB6-C7CF-47E1-AD93-(E-Mail Removed)...
> Hi I use Visual C++ MFC 4.2.
>
> I need to get the last support_code from the table so I make query like
> this:
> CString sSQL;
> sSQL.Format( "SELECT MAX( support_no ) AS \"last\" FROM history WHERE
> support_no LIKE \'%s*\'", sYear );
>
> I have tested it in the MS Access and it worked fine.
>
> It should return Support Code in the form like this: "S08-00012" so it has
> S
> and - characters inside.
>
> Now. the problem is from the programming side.
>
> rs.Open( CRecordset::forwardOnly, ( sSQL ) );
>
> CString sSupportNo;
> CString sNextCounter;
>
> if( !rs.IsEOF() ){
> rs.GetFieldValue( "last", varSupportNo );
> ASSERT( varSupportNo.m_dwType == DBVT_STRING );
>
> sSupportNo = *varSupportNo.m_pstring;
> }
>
> The error is at the ASSERT part. I know the error but I don't know how to
> fix it.
> The point is that the value of field "last" is not a CString. I don't know
> what it is, because I also have tried DOUBLE type it neither work.
>
> What is the return value of MAX to my code?
>
> Thank you very much.