What I need to do is have the data on the bottom line of my chart to show the full date as it is in the database that I take the data from. In the database it is in the form of 29/March/2005 and this is how I want it to display on the chart. my code is as follows:
Dim db As Database Dim qdef As QueryDef Dim rs As Recordset Dim dbname As String Dim i As Integer dbname = App.Path If Right$(dbname, 1) <> "\" Then dbname = dbname & "\" dbname = dbname & "FishKeeping.mdb" Set db = OpenDatabase(dbname) Set qdef = db.CreateQueryDef("", _ "SELECT Date, PH FROM WaterQuality") Set rs = qdef.OpenRecordset(dbOpenSnapshot) rs.MoveLast NumPoints = rs.RecordCount ReDim Values(1 To NumPoints, 1 To 2) rs.MoveFirst For i = 1 To NumPoints Values(i, 1) = Format$(rs!Date, "dd/MMMM/yyyy") Values(i, 2) = rs!PH rs.MoveNext Next i rs.Close db.Close Chart1.chartType = VtChChartType2dXY Chart1.RowCount = NumPoints Chart1.ColumnCount = 2 Chart1.ChartData = Values
All I get is the error: Type Mismatch and it highlights
Values(i, 1) = Format$(rs!Date, "dd/MMMM/yyyy")
But if I change this line to
Values(i, 1) = Format$(rs!Date, "yyyy")
it displays my chart but the bottom line only display by year. Am i missing something!?
It does all this if my database is set up to display the date as text or in date/time format.
Any help greatly appreciated sorry for the long query !
Hope all this makes sense!