Connecting Tech Pros Worldwide Help | Site Map

CreateProperty

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 23rd, 2007, 07:05 AM
chris@kissolutions.net
Guest
 
Posts: n/a
Default CreateProperty

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


  #2  
Old August 23rd, 2007, 01:45 PM
OldPro
Guest
 
Posts: n/a
Default 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.

  #3  
Old August 23rd, 2007, 11:35 PM
chris@kissolutions.net
Guest
 
Posts: n/a
Default 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

  #4  
Old August 24th, 2007, 04:25 PM
JHB
Guest
 
Posts: n/a
Default 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




 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

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 220,840 network members.