Connecting Tech Pros Worldwide Forums | Help | Site Map

CreateProperty

chris@kissolutions.net
Guest
 
Posts: n/a
#1: Aug 23 '07
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


OldPro
Guest
 
Posts: n/a
#2: Aug 23 '07

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.

chris@kissolutions.net
Guest
 
Posts: n/a
#3: Aug 24 '07

re: CreateProperty


On Aug 23, 11:38 pm, OldPro <rrossk...@sbcglobal.netwrote:
Quote:
On Aug 23, 2:03 am, ch...@kissolutions.net wrote:
>
>
>
>
>
Quote:
Hi
>
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!
>
Quote:
Chris - Sydney Australia
>
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

JHB
Guest
 
Posts: n/a
#4: Aug 24 '07

re: CreateProperty


Quote:
Quote:
Set db =
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




Closed Thread


Similar Microsoft Access / VBA bytes