Update (Requery?) records from unassociated form

K

Kelii

I've been trying to find an answer to this question in the groups all
day without luck.

So here is my situation:
I have a form (frmA) that has a button (cmdA) for calling another form
(frmB) which consists of a subform (sbfB) which displays a Pivot
Chart. When my code executes, a value from frmA is passed to an
unbound combo box control on frmB which in turn drives the query
behind the Pivot Chart sbfB.

The problem:
The Pivot Chart sbfB does not update (i.e., it shows no data
whatsoever). When I step through the code, sbfB goes through the load
procedure properly. However, when the combo box value on frmB is
updated, the associated After Update procedure does not execute.
Furthermore, my effort to requery the form seems to have on impact.
Note: sbfB works perfectly when opened independently by the user
(i.e., not via code).

Any help on how to get sbfB to refresh using code would be dearly
helpful.

Best,

Kelii

Here is my code:
Private Sub cmdA_Click()
On Error GoTo Error_Handler

DoCmd.OpenForm "frmB"
Forms![frmB]![cboControl] = (Me.ValueFromFormA)
Forms![frmB]![sbfB].Form.Requery

Exit_Procedure:
On Error Resume Next
Exit Sub
Error_Handler:
Select Case Err
Case Else
MsgBox "Error: " & Err.Number & vbCr & Err.Description
Resume Exit_Procedure
End Select
End Sub
 
K

Kelii

Apologies for the post, I believe I solved the problem by using the
following:

Forms!frmB!sbfB.Requery.

Again, apologies for the post.

Kelii
 
T

Tony Toews [MVP]

Kelii said:
Apologies for the post, I believe I solved the problem by using the
following:

Forms!frmB!sbfB.Requery.

Sounds about right.
Again, apologies for the post.

Not a problem. We're glad we could help. <smile>

Seriously though quite often taking the time to write down your
problem makes you think about the problem from a different angle.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 
A

Aaron Kempf

FOR SURE tony

one of the first thigns that I've ever agreed with you on (other than your
admission the other day that you can't have more than 10 people writing
stuff in a MDB at the same time)
 

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