RATE THIS ANSWER
+1
Click to Vote:
1
0
First, the decimal places property in the table does not indicate how many decimal places will be stored. It is only for displaying the decimal places.
To display the decimal places on the report, use the format property of the instrument field.
Here's an example of code that could be placed in the report's detail section On Format event:
Dim frmt As String, x As Integer, numplaces As Integer
frmt = "#." 'Set up the format string 1 digit in front of the decimal place
Select Case Me![Instrument]
Case "micrometer"
numplaces = 2
Case "caliper"
numplaces = 3
Case Else
numplaces = 4 'number of places for any other instrument not defined.
End Select
For x = 1 To numplaces
frmt = frmt & "0"
Next x
Me![InstrumentCalibration].Format = frmt
If you didn't want to hard code the instruments, you could place the number of places for the calibration in the table that is bound to the report. Then you could do this:
Dim frmt As String, x As Integer, numplaces As Integer
frmt = "#."
For x = 1 To me![numplaces] 'column in table that tells how many places for that instrument
frmt = frmt & "0"
Next x
Me![InstrumentCalibration].Format = frmt
Last Answered:
Sep 21 2009 1:51 PM GMT by Randym 
1410 pts.