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!

Changing number format properties of field in a Microsoft Access 2013 Database

Status
Not open for further replies.

Walter Cuypers

Programmer
Oct 4, 2018
2
BE
When you have a field type DOUBLE in your database that is bigger than 99.999.999.999 the Microsoft Access 2013 application will display the number (by default) in scientific format.

I have written a routine to turn off the scientific format an go back to a normal integer Number format without decimals. Other TEK-TIPS have helped me to get on track fast... thanks!

Procedure Call example :
Call Remove_Scientific_Format ("C:\Users\id980227\Documents\ProjectStatus.accdb", "MonthlyReport")


Public Sub Remove_Scientific_Format( AccessDatabase As String, TableName As String )

Dim Field As Field
Dim db As DataBase

Set db = OpenDatabase(AccessDatabase, True, False)

For Each Field In db.TableDefs(TableName).Fields
Select Case Field.name
Case "master_key", "circuit_id": Field.Properties.Append Field.CreateProperty( "format", dbText, "Fixed" )
Field.Properties.Append Field.CreateProperty( "decimalplaces", dbByte, 0 )
End Select
Next Field
db.TableDefs.Refresh

db.Close : set db = Nothing

End Sub
 
I forget to mention one important thing :

CreateProperty( "decimalplaces", dbSingle, 0 ) does not work on my Microsoft Access 2013.
CreateProperty( "decimalplaces", dbByte, 0 ) works correctly on my Microsoft Access 2013.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top