none
Increase decimal places for variable RRS feed

  • Question

  • How can I make a "PUs" variable format to be "15.0" instead "15"?

    I read a value from the table as Variant, but I want to write it later to text file with one decimal place after the dot (e.g. instead of 15 - 15.0, and instead 3 -3.0, etc.)

    Dim db As DAO.Database

    Dim rs As DAO.Recordset

    Dim PUs As Double

    Set db = CurrentDb()

    Set rs = db.OpenRecordset("product spec")

    PUs = Format((rs.Fields("PU").value), "0.0")

    Thursday, July 7, 2016 10:52 AM

Answers

  • The Format function returns a string expression so you need to declare the PUs variable as String not Double.

    Ken Sheridan, Stafford, England

    • Marked as answer by GyTasS Thursday, July 7, 2016 2:10 PM
    Thursday, July 7, 2016 11:17 AM