Re: Problem deleting records from datagrid



Thanks for the reply. You are probably right about it being due to having
two tables.

The reason I have two tables is that one contains the descriptions
eg
Ind1 Desc
1 desc 1
2 desc 2
3 desc 3
and the other, with all the records, contains only index numbers joined by
Ind1
eg
Ind2 Ind1
1 2
2 2
3 1
4 1
5 1
6 3
etc
which is how relational databases should be

However the records displayed in the datagrid need to have the description
displayed, the index number is meaningless to the user. Hence the two
tables.
It is strange that datagrids dont allow records to be deleted if there are
more than one table. I would have thought that anyone using relational
datatabases properly would have needed to use more than one table to display
the required data in a datagrid.

Im coming to the conclusion that VB and its use as a means of data
manipulation was not planned as a feature of the programming environment but
was just a badly designed after thought.

I thing your last suggestion of using an DELETE statement is the way around
the problem.
I would then need to refresh the data grid to display the changed data

to do this would
datagrid.refresh do

or would I have to close and then reopen the recordset first?

Ian




"Brian Schwartz" <brian@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Ov9nusIrFHA.2624@xxxxxxxxxxxxxxxxxxxxxxx
> Two tables is the problem I bet. You can try including a key for the other
> table as well. When you delete, a record from both tables will be deleted.
>
> If that doesn't work, include only one table in the grid, or arrange some
> alternate way of deleting from your grid, like a button that looks at what
> is selected in the grid, and then executes the appropriate delete
statement
> on the database.
>
> Hope that helps,
>
> --
> Brian Schwartz
> FishNet Components
> http://www.fishnetcomponents.com
> Building better tools for developers - Be part of it!
>
>
> "Ian Davies" <iandan.dav@xxxxxxxxxx> wrote in message
> news:rw7Qe.1180$h4.120@xxxxxxxxxxxxxxxxxxxxxxx
> > Yes, there are two tables in this query and one does have a primary key,
> > which is included in the query
> >
> >
> > "Brian Schwartz" <brian@xxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:OLD8qX1qFHA.908@xxxxxxxxxxxxxxxxxxxxxxx
> > > Does the query the datagrid uses to populate include a primary key
field
> > > from the table?
> > >
> > > --
> > > Brian Schwartz
> > > FishNet Components
> > > http://www.fishnetcomponents.com
> > > Building better tools for developers - Be part of it!
> > >
> > >
> > > "Ian Davies" <iandan.dav@xxxxxxxxxx> wrote in message
> > > news:60qOe.632$kx2.203@xxxxxxxxxxxxxxxxxxxxxxx
> > > > Hello
> > > > I have a datagrid linked to a query in Access. I can use this query
to
> > > > delete records from within Access but when I try to do the same from
> the
> > > > datagrid I get the message 'Insufficient key column information for
> > > updating
> > > > or refreshing'. However it lets me edit the records. I have
> > 'AllowDelete'
> > > > ticked in the datagrid's properties but this makes no difference
> > > >
> > > > Can anyone offer an explanation
> > > >
> > > > Thanks
> > > > Ian
> > > >
> > > >
> > >
> > >
> >
> >
>
>


.