Solved

Access SQL Create Table with Hyperlink and attachment fields

Posted on 2013-06-18
3
1,053 Views
Last Modified: 2013-06-19
Hi
I am using the following SQL in Access to create a test table. The only two fields that
cause problems are the Hyperlink and Attachment fields. What is the correct syntax
for these:

CREATE TABLE tblTest3
    (CustomerID INTEGER NOT NULL,
    [Test] YesNo,
    [Docs] Attachment,
    [Link] Hyperlink,
    Phone OLEObject,
    Email TEXT(50))
0
Comment
Question by:murbro
3 Comments
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 200 total points
ID: 39257789
AFAIK, hyperlink data type cannot be created with data definition language (SQL).
Probably same for attachment.
0
 
LVL 24

Accepted Solution

by:
chaau earned 300 total points
ID: 39258362
Jet SQL doesn't support creating attachment fields. You can use DAO for this purpose:
Sub Test()
    Dim dbs As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Set dbs = CurrentDb
    Set tdf = dbs.CreateTableDef(Name:="tblTest3")
    Set fld = tdf.CreateField(Name:="Docs", Type:=dbAttachment)
    tdf.Fields.Append fld
    dbs.TableDefs.Append tdf
    dbs.TableDefs.Refresh
End Sub

Open in new window

0
 

Author Closing Comment

by:murbro
ID: 39258704
Thanks very much
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

778 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