using a popup to update another forms table the right way...? (1 Viewer)

zozew

Registered User.
Local time
Tomorrow, 00:49
Joined
Nov 18, 2010
Messages
199
hi ya'll,

im working away on my db and its going quite ok, spent the day trying to sort my popup problem.

I have a popup based on a related table to the main forms table. opening the popup and changing some values from the popup table in the popup then clicking on a button to update a few fields in the main table with some of the values from the popup, I get a write error when i try to change record in the popup..sometimes...did a lot of googeling and it happens a lot apparently hehe..forms somehow editing the same record etc..

im trying to sort out what the correct way is to make a popup that can update records in the mainforms table while itself being based on a related table to the main table..

the popup does display a few fields from the main table related to the popups table but they are not being altered. A selection is made in a field and then on a click a DoCmd.runsql or the execute runs a sql update string...

Some suggested saving the record before running the sql..another says use dirty =false and so on...but whats the right way hehe did try a few but couldnt get a consistent result..

i really dont want to get the prompt asking me to save discard or copy the record to the clipboard when i try updating the record...

any guidance appreciated..
 

zozew

Registered User.
Local time
Tomorrow, 00:49
Joined
Nov 18, 2010
Messages
199
Sometimes i take the long way to get there...changed the fields in the popup that were used to update the main table to the actual related fields from the main table so when i change the values in the fields in popup no need to run any SQL at all...the fields update automatically in the main table..

Sorry for being slow...
 

MarkK

bit cruncher
Local time
Today, 09:49
Joined
Mar 17, 2004
Messages
8,186
and it happens a lot apparently hehe..forms somehow editing the same record
As the developer, this is under your control. Two simple rules of thumb . . .
1) Base a single form on a single table.
2) If a form is not in use, close it.
Hope this helps,
 

zozew

Registered User.
Local time
Tomorrow, 00:49
Joined
Nov 18, 2010
Messages
199
1) Base a single form on a single table.

This one seems a little weird..? what if i want to display related tables in my form...hmm not sure i get thats direct a "bad" thing...do you mind explaining just a tad more?

thx
 

MarkK

bit cruncher
Local time
Today, 09:49
Joined
Mar 17, 2004
Messages
8,186
Show each record of a parent table in a form. Then show related records of a child table in a subform. The subform edits the child table, the main form edits the parent table, and you have no collisions, your recordsources are simple, your user interface organization is intuitive. etc...
Hope that helps,
 

zozew

Registered User.
Local time
Tomorrow, 00:49
Joined
Nov 18, 2010
Messages
199
Ahhh ok now i understand what you mean, thanks a lot!
 

Users who are viewing this thread

Top Bottom