From: Arv212 on
i am using VB6 with Access 2003 using DAO object Library.does anybody know
how to add field to recordset(Not Table) at runtime?I know there is somethin
like..myRecordset.Fields.Append.Objectname.....I tried creating field object
and assigned to this method and it says "Runtime Erro:3273 Method not
Applicable for This object ".So,What kind of object we need to create for
this method to work?Any help will be appreciated.
Thanks in advance.
From: Jeff Johnson on
"Arv212" <Arv212(a)discussions.microsoft.com> wrote in message
news:5C3FCD9C-A1F3-45D0-AAA1-35EBE0A45E7F(a)microsoft.com...

>i am using VB6 with Access 2003 using DAO object Library.does anybody know
> how to add field to recordset(Not Table) at runtime?I know there is
> somethin
> like..myRecordset.Fields.Append.Objectname.....I tried creating field
> object
> and assigned to this method and it says "Runtime Erro:3273 Method not
> Applicable for This object ".So,What kind of object we need to create for
> this method to work?Any help will be appreciated.

Is the recordset already open? If so, then you can't add fields. If, for
example, you ran an SQL statement to create a recordset and then you tried
to add extra fields to it, this won't work. You'll have to create your
desired recordset completely through code, then open a second recordset from
the SQL statement, and then copy the data from the second recordset into
your target. Not easy, is it?



From: Arv212 on
Yes.You got my point.Recordset is already open.I am creating History for
changes.So,whenever I launch form,I am storing original data into one
recordset and when User leaves the form,i am storing Updated(may be) data
into second recorset.Then I compare 'em for any changes.Sounds easy.But thing
is that at run time user can Add extra fileds.(Let's say in Listbox Extra
entry-->Option I have provided to user).Since user can add couple of entries,
I ca't provide static fileds at design time.So for this reason I want to add
it at run time.User can also delete (List box entry) at run time then I want
to dele field for that entry.Any Idea.

Thanks fo your help.

"Jeff Johnson" wrote:

> "Arv212" <Arv212(a)discussions.microsoft.com> wrote in message
> news:5C3FCD9C-A1F3-45D0-AAA1-35EBE0A45E7F(a)microsoft.com...
>
> >i am using VB6 with Access 2003 using DAO object Library.does anybody know
> > how to add field to recordset(Not Table) at runtime?I know there is
> > somethin
> > like..myRecordset.Fields.Append.Objectname.....I tried creating field
> > object
> > and assigned to this method and it says "Runtime Erro:3273 Method not
> > Applicable for This object ".So,What kind of object we need to create for
> > this method to work?Any help will be appreciated.
>
> Is the recordset already open? If so, then you can't add fields. If, for
> example, you ran an SQL statement to create a recordset and then you tried
> to add extra fields to it, this won't work. You'll have to create your
> desired recordset completely through code, then open a second recordset from
> the SQL statement, and then copy the data from the second recordset into
> your target. Not easy, is it?
>
>
>
>
From: Jeff Johnson on
"Arv212" <Arv212(a)discussions.microsoft.com> wrote in message
news:656D91BA-E402-41FE-9759-F239C4A8404D(a)microsoft.com...

> Yes.You got my point.Recordset is already open.I am creating History for
> changes.So,whenever I launch form,I am storing original data into one
> recordset and when User leaves the form,i am storing Updated(may be) data
> into second recorset.Then I compare 'em for any changes.Sounds easy.But
> thing
> is that at run time user can Add extra fileds.(Let's say in Listbox Extra
> entry-->Option I have provided to user).Since user can add couple of
> entries,
> I ca't provide static fileds at design time.So for this reason I want to
> add
> it at run time.User can also delete (List box entry) at run time then I
> want
> to dele field for that entry.Any Idea.

There isn't much you can do besides creating a new recordset with the same
structure plus the new fields and then copy all the data to the new one.

You might be able to use a grid control which you just keep hidden all the
time instead of a recordset.


From: Bob Butler on

"Jeff Johnson" <i.get(a)enough.spam> wrote in message
news:eHNyGN45IHA.3784(a)TK2MSFTNGP06.phx.gbl...
> "Arv212" <Arv212(a)discussions.microsoft.com> wrote in message
> news:656D91BA-E402-41FE-9759-F239C4A8404D(a)microsoft.com...
>
>> Yes.You got my point.Recordset is already open.I am creating History for
>> changes.So,whenever I launch form,I am storing original data into one
>> recordset and when User leaves the form,i am storing Updated(may be) data
>> into second recorset.Then I compare 'em for any changes.Sounds easy.But
>> thing
>> is that at run time user can Add extra fileds.(Let's say in Listbox Extra
>> entry-->Option I have provided to user).Since user can add couple of
>> entries,
>> I ca't provide static fileds at design time.So for this reason I want to
>> add
>> it at run time.User can also delete (List box entry) at run time then I
>> want
>> to dele field for that entry.Any Idea.
>
> There isn't much you can do besides creating a new recordset with the same
> structure plus the new fields and then copy all the data to the new one.
>
> You might be able to use a grid control which you just keep hidden all the
> time instead of a recordset.

If the data is to be visible to the user then a grid would work and you can
associate the RowData array with the AbsolutePosition of the recordset
(assuming they aren't always the same order). If the data isn't visible to
the user just use an array or a collection or any preferred method to hold
the extra fields.