A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding fields



 
 
Thread Tools Display Modes
  #1  
Old January 3rd, 2005, 09:37 PM
Dodo2u
external usenet poster
 
Posts: n/a
Default Adding fields

I'm running a MakeTableQuery (if that is the proper translation from
Dutch) to create a new table after export of a batch of ASCII-data from a
different application, which is linked to the database.
This replaces each time the table that was used before, which is a pity
because several fields have to be added to that table. So far this has
been done manually.

How can it be done in VB? I have added some lines to the button code to
get this done automatically, but I cannot find the proper expression for
a selection (tick?) box (selectievakje?).

So, something similar to:

DoCmd.OpenQuery "A5-A6_keuze"

Dim db As DAO.Database
Dim tbl As DAO.TableDef
Dim fld As Field
Dim fld2 As Field
Dim Veld5 As Field
Set db = CurrentDb
Set tbl = db!janus
Set fld = tbl.CreateField("A5", dbBoolean)
Set fld2 = tbl.CreateField("A6", dbBoolean)
tbl.Fields.Append fld
tbl.Fields.Append fld2

db.Close

This works but the Boolean type gives a 0 or 1, not a selection box (that
little square that you can tick).

Appreciate any help!


  #2  
Old January 3rd, 2005, 10:51 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Mon, 03 Jan 2005 21:37:57 GMT, Dodo2u
wrote:

This works but the Boolean type gives a 0 or 1, not a selection box (that
little square that you can tick).


Two suggestions:

- Don't bother using table datasheets for data entry. They're not well
suited for that purpose. Use a Form; on the form you can use a
checkbox control bound to the Boolean field (or a textbox, or a combo
box, or...)

- Rather than running a MakeTable query and then patching up the table
afterward, consider creating a table with the needed fields; run a
Delete query to empty it followed by an Append query to load it with
the data from the textfile.

John W. Vinson[MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
refreshing field list after adding fields to a table Colorado General Discussion 5 October 28th, 2004 09:36 PM
Adding new fields to existing forms Alan in Canterbury Using Forms 1 August 19th, 2004 11:47 AM
Adding new fields to an existing form/subform Linda New Users 4 August 7th, 2004 12:03 AM
Adding several fields to arrive at a sum Chris Christian Read Using Forms 2 August 5th, 2004 10:12 PM
Adding fields in a table tpitman General Discussion 0 June 20th, 2004 05:08 PM


All times are GMT +1. The time now is 12:23 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.