Solved

SETTING ACCESS FIELD PROPERTIES FROM VB

Posted on 1998-10-08
6
191 Views
Last Modified: 2013-12-25
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
Comment
Question by:cmorok
  • 3
  • 2
6 Comments
 

Author Comment

by:cmorok
ID: 1496777
Edited text of question
0
 
LVL 3

Accepted Solution

by:
vmano earned 100 total points
ID: 1496778
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
 

Author Comment

by:cmorok
ID: 1496779
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!

 

Author Comment

by:cmorok
ID: 1496780
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
 
LVL 3

Expert Comment

by:vmano
ID: 1496781
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
 

Expert Comment

by:dreamingeagle
ID: 1496782
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question