Add New Field to Table

  • Thread starter Thread starter Bytecafe
  • Start date Start date
B

Bytecafe

After I run a Make Table query I would like to then add
an additional field in the table.

How can I automatically create a new field in a table.

My table name is tblBillingCust01 and I would like to add
a field called nFocusCustNameRef.

Thanks.
 
Hi,

In order to add a new field to an existing table (other than the user
interface) would need to use VBA code, see:

ACC2000: How to Use DAO to Programmatically Add an AutoNumber Field to a
Table
http://support.microsoft.com/default.aspx?scid=kb;en-us;210405

- and -

The Microsoft Visual Basic for Application help topic "CreateField"


I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights


--------------------
| Content-Class: urn:content-classes:message
| From: "Bytecafe" <[email protected]>
| Sender: "Bytecafe" <[email protected]>
| Subject: Add New Field to Table
| Date: Mon, 7 Jun 2004 17:19:24 -0700
| Lines: 9
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcRM7kCGeGzT8aAlQJ+e+uVZZTjTvA==
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa10.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.access.queries:203102
| NNTP-Posting-Host: tk2msftngxa08.phx.gbl 10.40.1.160
| X-Tomcat-NG: microsoft.public.access.queries
|
| After I run a Make Table query I would like to then add
| an additional field in the table.
|
| How can I automatically create a new field in a table.
|
| My table name is tblBillingCust01 and I would like to add
| a field called nFocusCustNameRef.
|
| Thanks.
|
 
After I run a Make Table query I would like to then add
an additional field in the table.

How can I automatically create a new field in a table.

My table name is tblBillingCust01 and I would like to add
a field called nFocusCustNameRef.

The simplest way might be to just include nFocusCustNameRef as a
calculated field in the MakeTable query in the first place: just put

nFocusCustNameRef: NULL

in a vacant Field cell in the query.
 
Bytecafe said:
After I run a Make Table query I would like to then add
an additional field in the table.

How can I automatically create a new field in a table.

My table name is tblBillingCust01 and I would like to add
a field called nFocusCustNameRef.

Hi Bytecafe,

As John mentioned just add it to the maketable query,
but if you use

nFocusCustNameRef: Null

you will end up with a binary field type.

A clever method Michel once demonstrated:

-- to end up with date/time field, all nulls
nFocusCustNameRef: IIf(True,Null,#1/1/1900#)

-- works for text and number also
nFocusCustNameRef: IIf(True,Null," ") <--get type text(255), all null
nFocusCustNameRef: IIf(True,Null,0) <--get type Long, all null

-- or use Cxxx functions
nFocusCustNameRef: IIf(True,Null,CCur(0)) <--get type Currency, all null
nFocusCustNameRef: IIf(True,Null,CDbl(0)) <--get type Double, all null

So clever...and eliminate "binary type" bugaboo
when you use

nFocusCustNameRef: Null

Please respond back if I have misunderstood.

Good luck,

Gary Walter
 
A clever method Michel once demonstrated:

-- to end up with date/time field, all nulls
nFocusCustNameRef: IIf(True,Null,#1/1/1900#)

-- works for text and number also
nFocusCustNameRef: IIf(True,Null," ") <--get type text(255), all null
nFocusCustNameRef: IIf(True,Null,0) <--get type Long, all null

-- or use Cxxx functions
nFocusCustNameRef: IIf(True,Null,CCur(0)) <--get type Currency, all null
nFocusCustNameRef: IIf(True,Null,CDbl(0)) <--get type Double, all null

So clever...and eliminate "binary type" bugaboo

INDEED! Noted; thanks Gary and Michel!
 
Back
Top