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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change size field in vba

Status
Not open for further replies.

hniessen

Technical User
Jan 31, 2002
12
0
0
NL
The first field of a table that is imported is a number with field size double. But the field size has to be a long integer. All the numbers in this field look like ##.0000000.

How is this done in VBA?

Greatings,
Hans
 
Taken from the Access help file:

A Field object represents a column of data with a common data type and a common set of properties.









Remarks

The Fields collections of Index, QueryDef, Relation, and TableDef objects contain the specifications for the fields those objects represent. The Fields collection of a Recordset object represents the Field objects in a row of data, or in a record. You use the Field objects in a Recordset object to read and set values for the fields in the current record of the Recordset object.

In both Microsoft Jet and ODBCDirect workspaces, you manipulate a field using a Field object and its methods and properties. For example, you can:

Use the OrdinalPosition property to set or return the presentation order of the Field object in a Fields collection. (This property is read-only for ODBCDirect databases.)


Use the Value property of a field in a Recordset object to set or return stored data.


Use the AppendChunk and GetChunk methods and the FieldSize property to get or set a value in an OLE Object or Memo field of a Recordset object.


Use the Type, Size, and Attributes properties to determine the type of data that can be stored in the field.


Use the SourceField and SourceTable properties to determine the original source of the data.
In Microsoft Jet workspaces, you can:

Use the ForeignName property to set or return information about a foreign field in a Relation object.


Use the AllowZeroLength, DefaultValue, Required, ValidateOnSet, ValidationRule, or ValidationText properties to set or return validation conditions.


Use the DefaultValue property of a field on a TableDef object to set the default value for this field when new records are added.
In ODBCDirect workspaces, you can:

Use the Value, VisibleValue, and OriginalValue properties to verify successful completion of a batch update.
Note For a complete list of all methods, properties, and collections available on a Field object in any database or connection, see the Summary topic.

To create a new Field object in an Index, TableDef, or Relation object, use the CreateField method.

When you access a Field object as part of a Recordset object, data from the current record is visible in the Field object's Value property. To manipulate data in the Recordset object, you don't usually reference the Fields collection directly; instead, you indirectly reference the Value property of the Field object in the Fields collection of the Recordset object.

To refer to a Field object in a collection by its ordinal number or by its Name property setting, use any of the following syntax forms:

Fields(0)

Fields("name")

Fields![name]

With the same syntax forms, you can also refer to the Value property of a Field object that you create and append to a Fields collection. The context of the field reference will determine whether you are referring to the Field object or the Value property of the Field object.
James Goodman
 
Hans,
Which table has the double data-type field, the source data or the destination? In what format is the source data; i.e., Is it an Access table, a text file, a spreadsheet, etc.?
Also, how can the number look like ##.00000, when the data type is to be long integer? Long integer doesn't allow decimals.
Let me know.
Mike K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top