Solved

SETTING ACCESS FIELD PROPERTIES FROM VB

Posted on 1998-10-08
6
178 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now