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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VB6 custom function in Crystal V10

Status
Not open for further replies.

themaj

Technical User
Apr 10, 2006
37
US
I have a custom function for a date format in VB6 that converts to a Long Integer(ie. 20060614) for populating my Access DB. I then use the opposing function below to convert to a readable date. Can anyone help me implement the function in Crystal 10.

Public Function fDateLong(plngDate As Long) ' Gets Date from DB format YYYYMMDD (DB date is Long) ,
Dim sDate, sYYYY, sMM, sDD As String
sDate = Trim(CStr(plngDate)) ' trim a Converted Long Date
sYYYY = Left(sDate, 4) ' get YYYY from left
sMM = Mid(sDate, 5, 2) 'get MM from middle
sDD = Right(sDate, 2) ' get DD from right
sDate = sMM & "/" & sDD & "/" & sYYYY ' reassemble
fDateLong = CDate(sDate) ' Convert to Date


End Function

Right now my date is reporting as " 20060612". Any help in implementing this function in Crystal would be appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top