Re: CREATE TABLE...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



By default (I mean, without changing setting) the Access Query designer uses
DAO instead of ADO and thus, has the same problem than DAO on some (most)
Jet 4 extensions.

As example,

CurrentDb.Execute "ALTER TABLE withDecimalOther (f1 DECIMAL)"

in the Immediate Debug Window returns an error and that is why I used
CurrentProject.Connection.Execute instead.



Vanderghast, Access MVP



"Ben" <Ben@xxxxxxxxxx> wrote in message
news:OodVGQfkJHA.1928@xxxxxxxxxxxxxxxxxxxxxxx
Michel,

Is there any way to just do it using query, ie, just CREATE TABLE...
instead of through code? I keep trying CREATE TABLE and it just wouldn't
work. BTW, I am using Access 2003 sp3.

Thanks for any assistance you can provide.

Ben



On 2/18/2009 11:06 AM, Michel Walsh wrote:
CurrentProject.Connection.Execute "CREATE TABLE withDecimal (f1
DECIMAL)"

to create the table with the default decimal type. You can create it with
a
scale, as usual, or bring modification too:


CurrentProject.Connection.Execute"ALTER TABLE withDecimal ALTER COLUMN
f1 DECIMAL(10, 2)"



You can try/test the previous lines of code quite easily by pasting them
into the Debug (Immediate) Window. No special setting required.



Note that even if that code uses ADO (CurrentProject), once the table is
created, you can still use DAO (CurrentDb) to access it further on.





Vanderghast, Access MVP





"Ben" <Ben@xxxxxxxxxx> wrote in message
news:eVbak0dkJHA.5732@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

Yesterday I posted a related question regarding join conditions. What I
would like to ask is how can I create an Access Table with a decimal
field as Michel Walsh suggested.

MGFoster suggested turning the Access database into ANSI-92 compatible
route using Tools->Optinns->Tables/Queries->SQL Server Compatible
Syntax, this database.

My question is: I can currently create a new table by clicking:
Table->New, and then select any field to be decimal, without turning on
the ANSI-92 feature on. Isn't there a way to just write a CREATE
TABLE... query to make this happen without turning ANSI-92 on? I worry
my existing queries might not work if I do. If you do, can you share
with me the exact syntax on the CREATE TABLE to create a decimal field?
I tried a few different ways and it just doesn't seem to work.

Thanks in advance,

Ben







.



Relevant Pages

  • Re: Running a query to check data entry
    ... The default version for Access 2000 or less is DAO. ... For ADO, make ... Set rst = New Recordset ... > run a query to find the Latest one. ...
    (microsoft.public.access.formscoding)
  • Re: New Info on Stupid Error Im not Seeing
    ... > I want to do away with DAO altogether because in Access 2003, ... Access 2003 *does* include a default reference set to DAO. ... I want to use ADO not DAO. ... > was written in my code as opposed to an Access Query Design. ...
    (microsoft.public.access.forms)
  • Re: Create View, Index
    ... Some of these depend on the library you use to execute the query, i.e. they might work only if executed under ADO (not DAO.) ... Here's an exmaple of how to create a view with ADO: ...
    (microsoft.public.access.queries)
  • Re: Auto-select next record alphabetically
    ... I've already got a query setup that selects the ... >that I'm not up to snuff with recordset programming yet. ... As for DAO vs. ADO, if you using the Jet database engine (or ...
    (microsoft.public.access.formscoding)
  • Re: How to enforce subtypes/supertypes in Access 2000?
    ... DAO is the native object model for Jet databases and, as such, is the ... ever need ADO. ... Private Sub SetContactType() ...
    (microsoft.public.access.tablesdbdesign)