CreateProperty 
August 23rd, 2007, 08:05 AM
| | | |
Hi
I have a simple split db, that I want to create a backend table with
Fields, PK, Indexes and Formats.
The problem I am getting is the Error No 3219 from this line of code:-
fldInd.Properties.Append prpFld
"You tried to append a property to a Properties collection of an
object that does not support user-defined properties. "
Set tdfEmpHrs = dbLink.CreateTableDef("tblEmpHrs")
'Create Fields
With tdfEmpHrs
'St Date - Create
Set fldInd = .CreateField("EmpHrsSt", dbDate)
.Fields.Append fldInd
'Properties
Set prpFld = fldInd.CreateProperty("Format")
prpFld.Type = dbText 'or
dbDate
prpFld.Value = "Short Date"
fldInd.Properties.Append prpFld
fldInd.Properties.Refresh
Ive tried this line of code too to Format the Date Field, with the
same error:-
Set prpFld = fldInd.CreateProperty("Format", dbDate or
dbText, "Short Date")
fldInd.Properties.Append prpFld
Im not sure why you have to use dbText Data Type in a dbDate Field,
but I saw it on one of Allen Browne's reply to a posting!
Any help would be appreciated!
Thanks for your time and efforts!
Chris - Sydney Australia | 
August 23rd, 2007, 02:45 PM
| | | | re: CreateProperty
On Aug 23, 2:03 am, ch...@kissolutions.net wrote: Quote:
Hi
>
I have a simple split db, that I want to create a backend table with
Fields, PK, Indexes and Formats.
>
The problem I am getting is the Error No 3219 from this line of code:-
fldInd.Properties.Append prpFld
>
"You tried to append a property to a Properties collection of an
object that does not support user-defined properties. "
>
Set tdfEmpHrs = dbLink.CreateTableDef("tblEmpHrs")
'Create Fields
With tdfEmpHrs
>
'St Date - Create
Set fldInd = .CreateField("EmpHrsSt", dbDate)
.Fields.Append fldInd
'Properties
Set prpFld = fldInd.CreateProperty("Format")
prpFld.Type = dbText 'or
dbDate
prpFld.Value = "Short Date"
fldInd.Properties.Append prpFld
fldInd.Properties.Refresh
>
Ive tried this line of code too to Format the Date Field, with the
same error:-
>
Set prpFld = fldInd.CreateProperty("Format", dbDate or
dbText, "Short Date")
fldInd.Properties.Append prpFld
>
Im not sure why you have to use dbText Data Type in a dbDate Field,
but I saw it on one of Allen Browne's reply to a posting!
>
Any help would be appreciated!
>
Thanks for your time and efforts!
>
Chris - Sydney Australia
| It isn't possible to add a field to a linked table through code. | 
August 24th, 2007, 12:35 AM
| | | | re: CreateProperty
On Aug 23, 11:38 pm, OldPro <rrossk...@sbcglobal.netwrote: Quote:
On Aug 23, 2:03 am, ch...@kissolutions.net wrote:
>
>
>
>
>> Quote:
I have a simple split db, that I want to create a backend table with
Fields, PK, Indexes and Formats.
| > Quote:
The problem I am getting is the Error No 3219 from this line of code:-
fldInd.Properties.Append prpFld
| > Quote:
"You tried to append a property to a Properties collection of an
object that does not support user-defined properties. "
| > Quote:
Set tdfEmpHrs = dbLink.CreateTableDef("tblEmpHrs")
'Create Fields
With tdfEmpHrs
| > Quote:
'St Date - Create
Set fldInd = .CreateField("EmpHrsSt", dbDate)
.Fields.Append fldInd
'Properties
Set prpFld = fldInd.CreateProperty("Format")
prpFld.Type = dbText 'or
dbDate
prpFld.Value = "Short Date"
fldInd.Properties.Append prpFld
fldInd.Properties.Refresh
| > Quote:
Ive tried this line of code too to Format the Date Field, with the
same error:-
| > Quote:
Set prpFld = fldInd.CreateProperty("Format", dbDate or
dbText, "Short Date")
fldInd.Properties.Append prpFld
| > Quote:
Im not sure why you have to use dbText Data Type in a dbDate Field,
but I saw it on one of Allen Browne's reply to a posting!
| > Quote: |
Any help would be appreciated!
| > Quote: |
Thanks for your time and efforts!
| >>
It isn't possible to add a field to a linked table through code.- Hide quoted text -
>
- Show quoted text -
| Hi OldPro
Im sad tell you, that you can add Tables, Fields, DataTypes, Indexes,
DefaultValues to Linked Tables. The problem I am having is the
"Format" Property for DateFields = "Short Date", and the "Format"
Property for a BooleanField = "Yes/No".
Thanks for your response.
Chris | 
August 24th, 2007, 05:25 PM
| | | | re: CreateProperty OpenDatabase("C:\DATA\Access\Access2002\ADataRepos itory.MDB") Quote: Quote:
Set tdf = db.TableDefs("Employees")
tdf.Fields.Append tdf.CreateField("DateAdded", dbDate)
Set fld = tdf.Fields("DateAdded")
fld.Properties.Append fld.CreateProperty("Format", dbText, "Short
| | Date") Quote: Quote:
Set fld = Nothing
Set tdf = Nothing
Set db = Nothing
I hope this is of help to you.
Larry Linson
Microsoft Access MVP
| >
| I have no problem using Larry's code.
The field is by me in "Short Date" format.
Regards
Jørn |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,662 network members.
|