With tdfNew
.Fields.Append .CreateField("ContactID", vbNumber)
.Fields.Append .CreateField("GroupA", vbCurrency)
...
End With
should work, but neither vbNumber or vbCurrency are valid (unless you've
declared them yourself). If ContactID is supposed to be a Long Integer, use
dbLong. Use dbCurrency for GroupA.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Pendragon" <(E-Mail Removed)> wrote in message
news:430FD72C-8FA9-4BFE-B83A-(E-Mail Removed)...
> Okay, I figured out the problem. For each field I was naming, I needed to
> add the following line prior to the Append:
>
> set fldName = tdfNew.CreateField(....)
>
> and then after each instance I needed to have the tdfNew.Fields.Append
> fldName
>
> Also, I discovered that the field definition is vbLong and vbNumber.
>
> Works like a charm.
>
> "Pendragon" wrote:
>
>> Access03/WinXP
>>
>> This should be fairly straightforward, so not sure what I am missing.
>> Looking at the help example for .CreateField (from the Northwind DB), I
>> am
>> following the same format:
>>
>> Set db = CurrentDb
>> set tdfNew = db.CreateTableDef("zTempBillInfo")
>>
>> {definition of recordset}
>> rs.MoveFirst
>> With tdfNew
>> .Fields.Append .CreateField("ContactID", vbNumber)
>> .Fields.Append .CreateField("GroupA", vbCurrency)
>> ...
>> End With
>>
>> The code is bombing on the first .Fields.Append with an error "Data Type
>> Conversion Error" (#3421).
>>
>> Ideas/suggestions?
>>
>> Thanks.
>>