|
-
Oct 5th, 2000, 03:16 AM
#1
Thread Starter
Hyperactive Member
Dear VB users
Please look at the next source:
Private Sub Form_Load()
Dim DB As Database
Dim TD As TableDef
Dim FD As Field
Set DB = CreateDatabase(“c:\q.mdb”, dbLangGeneral)
Set TD = DB.CreateTableDef("NewTable")
With TD
.Fields.Append .CreateField("NewField", dbLong)
'.Fields("NewField").........
'HOW DO i GIVE FIELD "NewField" DECIMAL PLACES???????????????
End With
End Sub
HELP!!!!!!!!!!!!!!!!!!!!
Can someone tell me how to give field "NewField" decimal places!
Nice regards,
Michelle.
-
Oct 5th, 2000, 06:37 AM
#2
Frenzied Member
dbLong will create a field of type Long Integer (which doesn't have decimals). Try using dbDecimal instead.
Some more types available;
Constant Description
dbBigInt Big Integer
dbBinary Binary
dbBoolean Boolean
dbByte Byte
dbChar Char
dbCurrency Currency
dbDate Date/Time
dbDecimal Decimal
dbDouble Double
dbFloat Float
dbGUID GUID
dbInteger Integer
dbLong Long
dbLongBinary Long Binary (OLE Object)
dbMemo Memo
dbNumeric Numeric
dbSingle Single
dbText Text
dbTime Time
dbTimeStamp Time Stamp
dbVarBinary VarBinary
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Oct 5th, 2000, 01:01 PM
#3
set the field to vbCurrency and then
Code:
'set default values to zero
Set td = db.TableDefs!NewTable
td.Fields!NewField.DefaultValue = 0
-
Oct 6th, 2000, 01:16 AM
#4
Thread Starter
Hyperactive Member
Hello larryn & Buzby,
Thanks for your information.
Michelle.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|