SubForm Requery Not Working

G

Guest

Hello:

I have a One to Many Form used in a checking account application that works
as designed. The subform transaction table is named called tblTransactions
and the form name is sfrmTblTransactions.

In addition to the Main and Subform described above, I also have a 2nd
subform that contains only one field. It displays the amount field from a
query that totals the current checking account balance.

When I enter a new check in the sfrmtblTransactions and save the record, I
want the 2nd form called sfrmqryAccountBalance to refresh itself and display
the new, updated checking account balance. This isn't happening, I have to
move to a new parent record and then back to the same parent record to see
the new, updated checking account balance.

I placed my little script in the "After Update" event for
sfrmqryAccountBalance as follows:

Private Sub Form_AfterUpdate()
Me![sfrmqryAccountBalance].Form.Requery
End Sub

Can someone please advise what I'm doing wrong. Am I placing the script in
the wrong place? Am I wording the script incorrectly?

Thanks,
rtbt
 
M

Marshall Barton

Robert said:
I have a One to Many Form used in a checking account application that works
as designed. The subform transaction table is named called tblTransactions
and the form name is sfrmTblTransactions.

In addition to the Main and Subform described above, I also have a 2nd
subform that contains only one field. It displays the amount field from a
query that totals the current checking account balance.

When I enter a new check in the sfrmtblTransactions and save the record, I
want the 2nd form called sfrmqryAccountBalance to refresh itself and display
the new, updated checking account balance. This isn't happening, I have to
move to a new parent record and then back to the same parent record to see
the new, updated checking account balance.

I placed my little script in the "After Update" event for
sfrmqryAccountBalance as follows:

Private Sub Form_AfterUpdate()
Me![sfrmqryAccountBalance].Form.Requery
End Sub

Can someone please advise what I'm doing wrong. Am I placing the script in
the wrong place? Am I wording the script incorrectly?


You are correct, that is the wrong place ;-)

You want to place it in the AfterUpdate event of the otem
that was changed. In this case it's the sfrmtblTransactions
record that's being changed so put it in that subform's
AfterUpdate event.

If sfrmqryAccountBalance is a subform inside
sfrmtblTransactions, then your code (above) is correct.

However, if sfrmqryAccountBalance is a subform on the main
form, then you would need to use:

Me.Parent.sfrmqryAccountBalance.Form.Requery
 
E

eos

AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top