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!

DataReport .... Date Formatting

Status
Not open for further replies.

PeterWallace

Programmer
Apr 28, 2003
210
AU
I am having trouble formatting dates on Data report ...

the Table date field may have a valid date , or a ZERO

and as ZERO is a valid date it is printed as 30/12/1899

I have already dumped the Table into a Msflexgrid ... and formatted the grid so these dates are shown as blank

is there a way that I can get the Date field on the report to display blank field .....

Long way would be to create a tempory table and load origional Data into that Table switching the Date fields to Text via using Format to display as a date or Blank ..
could then use this as Input to datareport ....

BUT have already done that in the MSFlexgrid

Can I use the MSFlexgrid as input to DataReport

instead of a table as in sample

With RptWaterHist
.DataMember = vbNullString
Set .DataSource = Altrst
.Caption = Trim(Printtitle)
With .Sections("Section1").Controls
.Item("ref").DataField = Altrst.Fields(0).Name
.Item("Billed").DataField = Altrst.Fields(1).Name
.Item("BilledDate").DataField = Altrst.Fields(2).Name)
.Item("Paid").DataField = Altrst.Fields(3).Name
.Item("PaidDate").DataField = Altrst.Fields(4).Name)
End With
.Sections("Section2").Controls.Item("TradeAs").Caption = ClientBName
.Sections("Section2").Controls.Item("PrintTitle").Caption = Printtitle
.Sections("Section2").Controls.Item("Abn").Caption = "ABN : " & ClientAbn
.Sections("Section2").Controls.Item("DeName").Caption = Tname
.Sections("Section2").Controls.Item("DeAddress").Caption = TAddress

.Sections("Section5").Controls.Item("Label4").Caption = BilleddoubleSTRING
.Sections("Section5").Controls.Item("Label5").Caption = PaiddoubleSTRING
.Sections("Section5").Controls.Item("Label6").Caption = DuedoubleSTRING

RptWaterHist.WindowState = 2

.Show vbModal
End With

 
PeterWallace, I believe it was DrJavaJoe that suggested this to me. Add this code to your Form Load event:

If IsDate(txtDateFrom.Text) And IsDate(txtDateTo.Text)

These are not date fields, but rather Text Boxes for entering dates. The code allowed me to display the Form containing the Text Boxes even if they were blank. The Form wouldn't display otherwise.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top