Problem with code for linked table modification (Tony Toews)

T

Tony Vrolyk

I am using the code sample at Tony Toews' web site for modification of a
linked table
http://www.granite.ab.ca/access/backendupdate.htm

Other than that page I cannot find any documentation that uses the same
methods so I am having a hard time expanding on it. In particular I need to
create some number fields (Currency and single) and set properties like
Format and Default Value. I can't seem to find how to do this. I can easily
figure out how to make the Currency or Single field but then adding the
other properties is apparently beyond me.

Also I have seen references to a different name for this method, something
like DDL ?? Apparently this is not DAO or ADO. I am exposing myself as a bit
of a hack, not being able to look at the code and tell definitely what type
of data access method is being used, but I still need to get it working so
if anyone can help out it would be appreciated.

Thanks
Tony Vrolyk
 
D

Douglas J. Steele

In the section of code

With tdfUpdate
Set tdfField = .CreateField("mType", dbLong)
.Fields.Append tdfField
tdfField.Properties.Append tdfField.CreateProperty("Caption",
dbText, "Mailing Type")
tdfField.Properties.Append tdfField.CreateProperty("Description",
dbText, _
"Null/1 Label/Mailing Label, 2-Excel")
End With

you can add code like:

tdfField.DefaultValue = "1.5"
tdfField.Properties.Append tdfField.CreateProperty("Format", dbText,
"#.00")

Note that default values are strings, even for numeric fields. (For text
fields, you actually have to ensure that quotes are included, so that you'd
need tdfField.DefaultValue = """abc""" or tdfField.DefaultValue = Chr$(34) &
"abc" & Chr$(34))
 
T

Tony Vrolyk

Thanks I will give that a try. For some reason I think I tried the format
property and I think I came up with basically the same thing you did but I
don't recall it working. But I was probably off. I will give it another try.

Tony
 
J

Jamie Collins

Tony Vrolyk said:
I have seen references to a different name for this method, something
like DDL ??

DDL = data definiation language e.g.

ALTER TABLE MyTable ADD MyIntCol INTEGER NOT NULL DEFAULT=0;

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top