Defining Format od a Field? 
Author Message
 Defining Format od a Field?

I have a VB 6 App in which I create a table, defining all of the fields
such as:

Set F30 = NewTBL.CreateField("NetScore", dbSingle)

Is there a way to specify that I want that field to be formatted to
always display twho places to the right of the decimal. As you enter the
"CreateField" is lists the only options as Name, Type and Size?

Any suggestions appreciated.

Also, I've bought about 6 different VB books but none have good
explinations and examples of creating tables, fields, etc. Any
suggestions on resources that may help?

Wayne



Wed, 27 Mar 2002 03:00:00 GMT  
 Defining Format od a Field?
IIRC, Format is a Field property that only exists if you define it.

Try something like:

Dim FProp as Property

Set F30 = NewTBL.CreateField("NetScore", dbSingle)
Set FProp = F30.CreateProperty("Format", dbText, "#.00")
F30.Properties.Append FProp

Quote:

> I have a VB 6 App in which I create a table, defining all of the fields
> such as:

> Set F30 = NewTBL.CreateField("NetScore", dbSingle)

> Is there a way to specify that I want that field to be formatted to
> always display twho places to the right of the decimal. As you enter the
> "CreateField" is lists the only options as Name, Type and Size?

> Any suggestions appreciated.

> Also, I've bought about 6 different VB books but none have good
> explinations and examples of creating tables, fields, etc. Any
> suggestions on resources that may help?

> Wayne

--

Beer, Wine and Database Programming.  What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://webhome.idirect.com/~djsteele/



Thu, 28 Mar 2002 03:00:00 GMT  
 Defining Format od a Field?
Doug;

Thanks for the response. Just checking..is the FProp really dbText instead of
dbSingle?

Also, what is IIRC?

I did some searching around and from what I founs I was wondering if I can use
statements like:

Dim Fprop2 as Property
Dim Fprop3 as Property

Set F30 = NewTBL.CreateField("NetScore", dbSingle)
Set FProp1 = F30.CreateProperty("Format", dbSingle, "Standard")
Set FProp2 = F30.CreateProperty("Decimal Places", dbSingle, "2")
F30.Properties.Append FProp1
F30.Properties.Append FProp2

TIA

Wayne

Quote:

> IIRC, Format is a Field property that only exists if you define it.

> Try something like:

> Dim FProp as Property

> Set F30 = NewTBL.CreateField("NetScore", dbSingle)
> Set FProp = F30.CreateProperty("Format", dbText, "#.00")
> F30.Properties.Append FProp


> > I have a VB 6 App in which I create a table, defining all of the fields
> > such as:

> > Set F30 = NewTBL.CreateField("NetScore", dbSingle)

> > Is there a way to specify that I want that field to be formatted to
> > always display twho places to the right of the decimal. As you enter the
> > "CreateField" is lists the only options as Name, Type and Size?

> > Any suggestions appreciated.

> > Also, I've bought about 6 different VB books but none have good
> > explinations and examples of creating tables, fields, etc. Any
> > suggestions on resources that may help?

> > Wayne

> --

> Beer, Wine and Database Programming.  What could be better?
> Visit "Doug Steele's Beer and Programming Emporium"
> http://webhome.idirect.com/~djsteele/



Thu, 28 Mar 2002 03:00:00 GMT  
 Defining Format od a Field?

Quote:

> Doug;

> Thanks for the response. Just checking..is the FProp really dbText instead of
> dbSingle?

The type of the Property depends on the property. Formats are strings
(such as the word "Standard" that you show in your example, or the
string "#.00" that I showed in mine). Other properties, such as Decimal
Places, are numeric (and therefore should be defined as 2, not "2", as
you have in your example). I suspect the Decimal Places property would
be dbInteger, rather than dbSingle, but I'm not positive, and I'm too
lazy to check! <g>

Quote:
> Also, what is IIRC?

If I Recall Correctly...

Quote:
> I did some searching around and from what I founs I was wondering if I can use
> statements like:

> Dim Fprop2 as Property
> Dim Fprop3 as Property

> Set F30 = NewTBL.CreateField("NetScore", dbSingle)
> Set FProp1 = F30.CreateProperty("Format", dbSingle, "Standard")
> Set FProp2 = F30.CreateProperty("Decimal Places", dbSingle, "2")
> F30.Properties.Append FProp1
> F30.Properties.Append FProp2

Yes, with the changes I mentioned above.

Quote:


> > IIRC, Format is a Field property that only exists if you define it.

> > Try something like:

> > Dim FProp as Property

> > Set F30 = NewTBL.CreateField("NetScore", dbSingle)
> > Set FProp = F30.CreateProperty("Format", dbText, "#.00")
> > F30.Properties.Append FProp


> > > I have a VB 6 App in which I create a table, defining all of the fields
> > > such as:

> > > Set F30 = NewTBL.CreateField("NetScore", dbSingle)

> > > Is there a way to specify that I want that field to be formatted to
> > > always display twho places to the right of the decimal. As you enter the
> > > "CreateField" is lists the only options as Name, Type and Size?

> > > Any suggestions appreciated.

> > > Also, I've bought about 6 different VB books but none have good
> > > explinations and examples of creating tables, fields, etc. Any
> > > suggestions on resources that may help?

> > > Wayne

--

Beer, Wine and Database Programming.  What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://webhome.idirect.com/~djsteele/



Thu, 28 Mar 2002 03:00:00 GMT  
 Defining Format od a Field?
Makes sense... I'll go try it!
Quote:


> > Doug;

> > Thanks for the response. Just checking..is the FProp really dbText instead of
> > dbSingle?

> The type of the Property depends on the property. Formats are strings
> (such as the word "Standard" that you show in your example, or the
> string "#.00" that I showed in mine). Other properties, such as Decimal
> Places, are numeric (and therefore should be defined as 2, not "2", as
> you have in your example). I suspect the Decimal Places property would
> be dbInteger, rather than dbSingle, but I'm not positive, and I'm too
> lazy to check! <g>

> > Also, what is IIRC?

> If I Recall Correctly...

> > I did some searching around and from what I founs I was wondering if I can use
> > statements like:

> > Dim Fprop2 as Property
> > Dim Fprop3 as Property

> > Set F30 = NewTBL.CreateField("NetScore", dbSingle)
> > Set FProp1 = F30.CreateProperty("Format", dbSingle, "Standard")
> > Set FProp2 = F30.CreateProperty("Decimal Places", dbSingle, "2")
> > F30.Properties.Append FProp1
> > F30.Properties.Append FProp2

> Yes, with the changes I mentioned above.


> > > IIRC, Format is a Field property that only exists if you define it.

> > > Try something like:

> > > Dim FProp as Property

> > > Set F30 = NewTBL.CreateField("NetScore", dbSingle)
> > > Set FProp = F30.CreateProperty("Format", dbText, "#.00")
> > > F30.Properties.Append FProp


> > > > I have a VB 6 App in which I create a table, defining all of the fields
> > > > such as:

> > > > Set F30 = NewTBL.CreateField("NetScore", dbSingle)

> > > > Is there a way to specify that I want that field to be formatted to
> > > > always display twho places to the right of the decimal. As you enter the
> > > > "CreateField" is lists the only options as Name, Type and Size?

> > > > Any suggestions appreciated.

> > > > Also, I've bought about 6 different VB books but none have good
> > > > explinations and examples of creating tables, fields, etc. Any
> > > > suggestions on resources that may help?

> > > > Wayne

> --

> Beer, Wine and Database Programming.  What could be better?
> Visit "Doug Steele's Beer and Programming Emporium"
> http://webhome.idirect.com/~djsteele/



Thu, 28 Mar 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. problem with Format and a user defined date format

2. Read HTML formatted data from database field, Insert Wordmerge fields, and save as Word document

3. bound masked field to date/time field in access not formatting right

4. Define View-Auto Format-Condition?

5. changing formatting for defined text strings

6. defining a clipboard format

7. User-defined Clipboard Formats in Visual Basic 4/5

8. Using CDate with user-defined formats

9. Defining Format for a Text Box

10. User Defined Field in Item and User Defined Field in Folder.

11. ASCII value od extended characters same from DOS

12. procedur od telnet

 

 
Powered by phpBB® Forum Software