Can't add to recordset?!? 
Author Message
 Can't add to recordset?!?

Hi,

I'm fairly new to SQL and VB db stuff, so hopefully someone can help me
with this.  I have used the following to create a recordset:

Set dOther_Roles = MDIstart.DB.OpenRecordset("select otr.case_id,
otr.oth_role_id,  otr.pty_fl, otr.role_type, otr.addr_1, otr.addr_2,
otr.addr_3, otr.addr_4, otr.descr, otr.fam_name, otr.forenames,
otr.oth_pty_id, otr.pst_cde, otr.tel, rt.descr as [rtdescr] from
other_roles otr inner join  ref_types rt on otr.role_type = rt.code
where otr.case_id = " & Current_Case & " and otr.role_type = rt.code and
rt.domain = 'other_role'", dbOpenDynaset)

Which returns a recordset fine.  But when I try to:

dOther_roles.addnew

I get an error that the database or object is read-only.

Why would that be?  And how can I get round it?

Thanks,

Jason



Mon, 14 Apr 2003 22:14:24 GMT  
 Can't add to recordset?!?
This may or may not be your problem but would be worth checking. Using
Windows explorer find the db file. Right click it's icon and bring up
the properties dialog. Check that the Read Only check box is unchecked
and the Archive check box is checked.

If this dosen't work, repost and let us know whether you're using DAO
or ADO.

Cheers
Dave

In article


Quote:

> Hi,

> I'm fairly new to SQL and VB db stuff, so hopefully someone can help
me
> with this.  I have used the following to create a recordset:

> Set dOther_Roles = MDIstart.DB.OpenRecordset("select otr.case_id,
> otr.oth_role_id,  otr.pty_fl, otr.role_type, otr.addr_1, otr.addr_2,
> otr.addr_3, otr.addr_4, otr.descr, otr.fam_name, otr.forenames,
> otr.oth_pty_id, otr.pst_cde, otr.tel, rt.descr as [rtdescr] from
> other_roles otr inner join  ref_types rt on otr.role_type = rt.code
> where otr.case_id = " & Current_Case & " and otr.role_type = rt.code
and
> rt.domain = 'other_role'", dbOpenDynaset)

> Which returns a recordset fine.  But when I try to:

> dOther_roles.addnew

> I get an error that the database or object is read-only.

> Why would that be?  And how can I get round it?

> Thanks,

> Jason

--
dcward

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 18 Apr 2003 17:19:51 GMT  
 Can't add to recordset?!?

Try:
SQL="INSERT INTO YourTable(Field,...)  VALUES(12,....)"
DB.Execute (SQL)


Quote:
> This may or may not be your problem but would be worth checking. Using
> Windows explorer find the db file. Right click it's icon and bring up
> the properties dialog. Check that the Read Only check box is unchecked
> and the Archive check box is checked.

> If this dosen't work, repost and let us know whether you're using DAO
> or ADO.

> Cheers
> Dave

> In article


> > Hi,

> > I'm fairly new to SQL and VB db stuff, so hopefully someone can help
> me
> > with this.  I have used the following to create a recordset:

> > Set dOther_Roles = MDIstart.DB.OpenRecordset("select otr.case_id,
> > otr.oth_role_id,  otr.pty_fl, otr.role_type, otr.addr_1, otr.addr_2,
> > otr.addr_3, otr.addr_4, otr.descr, otr.fam_name, otr.forenames,
> > otr.oth_pty_id, otr.pst_cde, otr.tel, rt.descr as [rtdescr] from
> > other_roles otr inner join  ref_types rt on otr.role_type = rt.code
> > where otr.case_id = " & Current_Case & " and otr.role_type = rt.code
> and
> > rt.domain = 'other_role'", dbOpenDynaset)

> > Which returns a recordset fine.  But when I try to:

> > dOther_roles.addnew

> > I get an error that the database or object is read-only.

> > Why would that be?  And how can I get round it?

> > Thanks,

> > Jason

> --
> dcward

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Fri, 18 Apr 2003 18:07:07 GMT  
 Can't add to recordset?!?
Hi,

Thanks for replying.  I'm using DAO in VB 4.  I am actually trying to
amend some existing code - basically, previously the routine would
create a recordset from one table so the recordset would be of
table-type.  I need this recordset to be a dynaset as it now needs to
contain a field from another table.  I have specified dbopendynaset in
case the prob was being caused by the recordset being created as a
snapshot.  As well as addnew, I also need to edit the recordset, and
this is also giving me the same message (database or object read-only).
It's strange because the problem doesn't manifest if the recordset is of
table-type.  I'm probably doing something really dumb, but I can't
figure it out and it's driving me nuts!!!  

Thanks,

Jay



Fri, 18 Apr 2003 22:44:17 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 'Canned' data in VB program

2. Can't add a field to an ADO recordset in code

3. add record to disconnected shaped recordsets' child

4. Can we Add Recordset in another Recordset

5. Opened Recordsets don't show up in Recordsets Collection

6. Manipulating a recordset from a DataGrid's Recordset property

7. How do I create a canned form?

8. Canned AcctReceivable Module needed!

9. Canned pages....

10. Cans access2.0 engine access btrieve files?

11. Crystal Reports Canned Code

12. Canned objects and/or images

 

 
Powered by phpBB® Forum Software