Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update query not updating current record 1

Status
Not open for further replies.

wshm

Programmer
Dec 7, 2006
62
0
0
US
'after event of cmdDone from "frm_contractLiq"

DoCmd.OpenQuery "qry_PSCLiqAmt"
DoCmd.OpenQuery "qry_PSCBalanceUpdate"

DoCmd.OpenQuery "qry_BudMasterCashd"
DoCmd.OpenQuery "qry_BudMastercontp"
DoCmd.OpenQuery "qry_BudMasterTotex"
DoCmd.OpenQuery "qry_BudMasterBalance"

DoCmd.OpenForm "frm_ContractMenu"

i have this query that needs to update 3 tables after update on the form. it was very complicated so i figured i can use update queries to do the job for me.

i don't know if it's because im running so man queries but for some reason, queries only update the previous record.
When i click done from frm_contractLiq, I would check all the tables and I see bunch of null fields.
if i open the frm_contractLiq again to enter another record and check the table, it actually updates the "previous data" and null fields are now updated. if I were to enter more records, it keeps updating fine but it won't update the current record that I enter to the form.

ie. lets say i put in 500 for liqAmt.(from form)

LiqAmt (table)
null

i put another 200 for liqAmt.

LiqAmt |
500 |

if i were to put another 100

LiqAmt |
700 |

and forth. most of the queries are DSum update queries..
any idea why this is happening?
 
If you have a form and you create a new record that you then want to update, you will need to post that new record BEFORE running your updates.

Are you posting the new record before applying your updates?

How does the update query know which record to update? The last one added to the database? In that case, since you haven't posted the current record, the updates find the previous one.

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for database developers:
The Fundamentals of Relational Database Design
Understanding SQL Joins
 
is there such way to post before running updates?

I assumed data entered by user on the form is saved to the table as soon as it loses focus...
 
DoCmd.RunCommand acCmdSaveRecord
DoEvents
DoCmd.OpenQuery "qry_PSCLiqAmt"
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
i have to run more tests but i think it's working!!!
i'll get back to you.
 
i've tested it through many times and it's working. thank you for your replies
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top