dbTalk Databases Forums  

Updating a related table

comp.databases.ms-access comp.databases.ms-access


Discuss Updating a related table in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gerry Abbott
 
Posts: n/a

Default Updating a related table - 12-01-2004 , 10:19 AM






Hi all,
Im using the after update event of a field from a bound form to add records
using the recordset object, to a related table. However i'm getting the 3201
error, telling me I must have a related record in the parent table. But i've
just put it in, since the 'afterupdate' wont fire until i have ? It works
fine when i'm changing the record in the parent table, since im not changing
the primary key, but happens when i'm adding a new record.

Any explaination, or advice most welcome

Gerry Abbott








Reply With Quote
  #2  
Old   
Gerry Abbott
 
Posts: n/a

Default Re: Updating a related table - 12-01-2004 , 10:23 AM






Apologies for not testing this further,

It is not working with the update, and uses the 'non-updated' data to update
the related table, not the updated!


"Gerry Abbott" <please (AT) ask (DOT) ie> wrote

Quote:
Hi all,
Im using the after update event of a field from a bound form to add
records using the recordset object, to a related table. However i'm
getting the 3201 error, telling me I must have a related record in the
parent table. But i've just put it in, since the 'afterupdate' wont fire
until i have ? It works fine when i'm changing the record in the parent
table, since im not changing the primary key, but happens when i'm adding
a new record.

Any explaination, or advice most welcome

Gerry Abbott










Reply With Quote
  #3  
Old   
Dave M
 
Posts: n/a

Default Re: Updating a related table - 12-01-2004 , 11:27 AM



It sounds like you need to save the parent record before adding the new
child ones. The value of the field may be getting updated, but this does not
save the record. If you precede your record-adding code with

DoCmd.RunCommand acCmdSaveRecord

that should help.

"Gerry Abbott" <please (AT) ask (DOT) ie> wrote

Quote:
Hi all,
Im using the after update event of a field from a bound form to add
records
using the recordset object, to a related table. However i'm getting the
3201
error, telling me I must have a related record in the parent table. But
i've
just put it in, since the 'afterupdate' wont fire until i have ? It works
fine when i'm changing the record in the parent table, since im not
changing
the primary key, but happens when i'm adding a new record.

Any explaination, or advice most welcome

Gerry Abbott










Reply With Quote
  #4  
Old   
Gerry Abbott
 
Posts: n/a

Default Re: Updating a related table - 12-01-2004 , 11:42 AM



Hit the nail right on the head
Thanks Dave,


"Dave M" <NOSPAMdmacmurc (AT) DROPTHISisland (DOT) net> wrote

Quote:
It sounds like you need to save the parent record before adding the new
child ones. The value of the field may be getting updated, but this does
not
save the record. If you precede your record-adding code with

DoCmd.RunCommand acCmdSaveRecord

that should help.

"Gerry Abbott" <please (AT) ask (DOT) ie> wrote in message
news:1amrd.42996$Z14.18490 (AT) news (DOT) indigo.ie...
Hi all,
Im using the after update event of a field from a bound form to add
records
using the recordset object, to a related table. However i'm getting the
3201
error, telling me I must have a related record in the parent table. But
i've
just put it in, since the 'afterupdate' wont fire until i have ? It works
fine when i'm changing the record in the parent table, since im not
changing
the primary key, but happens when i'm adding a new record.

Any explaination, or advice most welcome

Gerry Abbott












Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.