?
Solved

Access SQL Create Table with Hyperlink and attachment fields

Posted on 2013-06-18
3
Medium Priority
?
1,148 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:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 26

Assisted Solution

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

Accepted Solution

by:
chaau earned 1200 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:Murray Brown
ID: 39258704
Thanks very much
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 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