Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Reports reportobject check for date field

Status
Not open for further replies.

LFB

Programmer
Jul 2, 2001
38
0
0
AU
Hi All,

Going out of my friggin mind trying to work this bloody thing out. Appreciate any help. I've searched everywhere but suspect I probably don't know the right keywords because this is so easy and I shouldn't be finding it so hard.

Using win xp, sp2, vb 6, crystal 10
referencing craxdrt

All I am trying to do is check to see if the stupid report object in my report is a date field. How hard can it be?

My code so far:

Declarations
Code:
    Dim CRXSections As CRAXDRT.Sections
    Dim CRXSection As CRAXDRT.Section
    Dim CRXReportObjects As CRAXDRT.ReportObjects
    Dim CRXReportObject As Object

Loop
Code:
    For Each CRXSection In CRXSections
    
        Set CRXReportObjects = CRXSection.ReportObjects
        
        For Each CRXReportObject In CRXReportObjects
            
            'check to make sure it is a field object
            If CRXReportObject.Kind = crFieldObject Then
                
                'check to see if it is a date field
                If CRXReportObject.Field.ValueType = crDateTime Then 'how do you do this part????  This check doesn't work!
                    CRXReportObject.DateOrder = crMonthDayYear
                End If
            
            End If
            
        Next CRXReportObject
    
    Next CRXSection

So the line that says:
Code:
If CRXReportObject.Field.ValueType = crDateTime

is not returning the right value. ValueType is returning 16, crDateTime return 10 so I'm either using the wrong method or the wrong enum or everything is wrong. Anyone know the answer to this?

thanks
lfb
 
I think I found it. My code should have been:

Code:
If .Field.ValueType = crDateTimeField Then

Using this seems to work anyway. Thanks for letting me vent.

lfb

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top