Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

SETTING ACCESS FIELD PROPERTIES FROM VB

I've to create two new fields in an existing table of an existing Access Database from VB5. I used "createfield and append" to the table and it was all ok. But the problem is to set the Access properties that are not the same of DAO. For example i am not able to set the ACCESS FORMAT FIELD Property: I want to see "TRUE/FALSE" in the database record instead of seeing "0/-1" without stting it from Access. How can I do this ? How can I append a new Access property to DAO ? Thanks.
0
cmorok
Asked:
cmorok
  • 3
  • 2
1 Solution
 
cmorokAuthor Commented:
Edited text of question
0
 
vmanoCommented:
Dim DB As Database
Dim TD As TableDef
   
   Set DB = OpenDatabase("C:\Manohar\ExPRSDB\ECMV1_1.mdb")
   Set TD = DB.CreateTableDef("NewTableDef")
'Create and append new Field objects for the new TableDef object.
   With TD      
      .Fields.Append .CreateField("Boolean", dbBoolean)
      .Fields.Append .CreateField("IntegerField", dbInteger)
      .Fields.Append .CreateField("DateField", dbDate)
    End With
   DB.TableDefs.Append TD
   DB.Close
   MsgBox "Fields appended"

The Boolean type will set the Yes/No values in the field which are equivalent to True/False.

let me know if this helps,
vmano
0
 
cmorokAuthor Commented:
The problem is that if you open the database from Access you find  the field  fill from "0/-1"  and not True/false or Yes/No: how can I set the "format" property of Access that show the type of visualisation of the field ? Thanks for your   interest
Carlo.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cmorokAuthor Commented:
The problem is that if you open the database from Access you find  the field  fill from "0/-1"  and not True/false or Yes/No: how can I set the "format" property of Access that show the type of visualisation of the field ? Thanks for your   interest
Carlo.
0
 
vmanoCommented:
when you create the field with dbBoolean as the option, it will be Yes/No in the design mode and when you open the table it will be a checkbox. i don't see any 0/1 in the table.
and as far as i know, you can not format a field while creating or after creation from your VB code, but you can always format the data which is being retrieved from the table.

0
 
dreamingeagleCommented:
I'm new to VB programming, but I also tried to change the Format property in the Access design mode, hoping it would carry over into VB.  But I think it only applies to how the data is displayed in Access.  When you see the Boolean field in a VB data grid, for instance, it will be 0/-1.  I think you have to do all the formatting from VB.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now