Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / January 2005

Tip: Looking for answers? Try searching our database.

Adding fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dodo2u - 03 Jan 2005 21:37 GMT
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!
John Vinson - 03 Jan 2005 22:51 GMT
>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]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.