Createtabledef problem

K

Kowsy

Hi

I am trying to set the property for a currency field and i am getting tpe
mismatch.

This is a part of code doing currency data type formatting
Set fld = .CreateField("curr", dbCurrency)
set fformat = fld.createproperty("Format",dbtext,"standard")
Set fformat = fld.CreateProperty("decimal places", dbByte, 2)
fld.Properties.Append fformat

I tried different logic,but still getting the same error

Can anyone help me on this
Thanks in advance
 
M

Marshall Barton

Kowsy said:
I am trying to set the property for a currency field and i am getting tpe
mismatch.

This is a part of code doing currency data type formatting
Set fld = .CreateField("curr", dbCurrency)
set fformat = fld.createproperty("Format",dbtext,"standard")
Set fformat = fld.CreateProperty("decimal places", dbByte, 2)
fld.Properties.Append fformat


You need to append each property.

However that code is out of context and there may be many
other reasons for the error.

Are you really sure that you want to be adding new fields to
a table in code???

If this is part of some data mdb new version installation,
then it may be a sensible thing to do, but those properties
are probably useless. You should set the format property of
any text boxes that display the field's value.
 
D

Dirk Goldgar

In
Kowsy said:
Hi

I am trying to set the property for a currency field and i am getting
tpe mismatch.

This is a part of code doing currency data type formatting
Set fld = .CreateField("curr", dbCurrency)
set fformat = fld.createproperty("Format",dbtext,"standard")
Set fformat = fld.CreateProperty("decimal places", dbByte, 2)
fld.Properties.Append fformat

I tried different logic,but still getting the same error

Can anyone help me on this
Thanks in advance

Where are you getting the error, and how did you declare fld and
fformat?

If you have both the DAO and ADO libraries referenced, you probably need
to disambiguate the declarations. That is, instead of

Dim fld As Field
Dim fformat As Property

you should say

Dim fld As DAO.Field
Dim fformat As DAO.Property

to make it clear which library is defining these objects.
 
K

Kowsy

Hi,

Thank you very much for your help.
I first created the fields and then appended
Then for each of the fields that i created i set the property and appended
each one by one
That worked great!!
Thanks again
 

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