Had to resort to SendKeys{F9}!

  • Thread starter Bill R via AccessMonster.com
  • Start date
B

Bill R via AccessMonster.com

I had been using the following code:

With Me
..sfrmPE.Form.Requery
..sfrmPE.Form.RecordSource = .sfrmPE.Form.RecordSource
..sfrmPEFactors.Form.Requery
..sfrmPEFactors.Form.RecordSource = .sfrmPEFactors.Form.RecordSource
End With

And up until a few minutes ago it had successfully requeried the subforms. I
added the "RecordSource" lines because the Requery had stopped working.

The code steps right through the lines, but it does nothing. The subforms
have all empty fields until I hit F9 to manually requery the form. Of course,
I can't ask my users to do this, so I've had to add the line:

SendKeys{F9}

,at the end of my code. I'm using A2K on an XP Pro machine.

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via AccessMonster.com
 
A

Albert D.Kallal

Bill R via AccessMonster.com said:
I had been using the following code:

With Me
.sfrmPE.Form.Requery
.sfrmPE.Form.RecordSource = .sfrmPE.Form.RecordSource
.sfrmPEFactors.Form.Requery
.sfrmPEFactors.Form.RecordSource = .sfrmPEFactors.Form.RecordSource
End With

Why are you repeating all of that code above?

You should ONLY need

me.sfrmPE.form.Requery

The REAL problem is WHEN do you execute the above code? There is something
seriously wrong here.....
 
R

ragtopcaddy via AccessMonster.com

My reason for the recordsource code can be found in a response from Dirk
Goldgar to another post of mine:
http://www.accessmonster.com/Uwe/Fo...reflected-in-subform-display#5d8baafd137b2uwe

I followed his advice and it worked perfectly.

There is definitely something fishy going on with this requery failure, but I
can't figure out why the .requery doesn't work, while the SendKeys{F9}, which
does essentially the same thing, does.
As for repeating, there are 2 subforms which originally were being requeried
only. I added the recordsource code to see if that would remedy the situation.
It didn't. But, I thought anyone trying to help out would like to be aware of
what I already tried.

Bill R
I had been using the following code:
[quoted text clipped - 4 lines]
.sfrmPEFactors.Form.RecordSource = .sfrmPEFactors.Form.RecordSource
End With

Why are you repeating all of that code above?

You should ONLY need

me.sfrmPE.form.Requery

The REAL problem is WHEN do you execute the above code? There is something
seriously wrong here.....
 
R

ragtopcaddy via AccessMonster.com

The code executes at the very end of a combo box AfterUpdate procedure.
I had been using the following code:
[quoted text clipped - 4 lines]
.sfrmPEFactors.Form.RecordSource = .sfrmPEFactors.Form.RecordSource
End With

Why are you repeating all of that code above?

You should ONLY need

me.sfrmPE.form.Requery

The REAL problem is WHEN do you execute the above code? There is something
seriously wrong here.....
 
A

Albert D.Kallal

ragtopcaddy via AccessMonster.com said:
The code executes at the very end of a combo box AfterUpdate procedure.

I don't see what the problem here...I going to suggest that you try forcing
a disk write.

me.Refresh
me.sfrmPEFactors.Form.Requery


The above is at most what you should need here. Is the sub-form setup as a
link child/link master field?

Is the sub-forms reocrdsouce based on the value of the combo box in anyway?
If the sql of the sub-form is based on a parameter query, then the above
disk write should fix this. (might be a issue of how the parameter is picked
up...but not yet written to disk.

If you do have a parameter query in the sub-form, I would just dump it. To
many difficulties come up as to when what fires in what order.
I would actually DUMP the parameter query, and simply stuff the sql right
into the forms reocrdsouce in the combo after update event. This approach
works much better...

eq:

me.refresh

strSql = "select * from tblForSubForm here someID = " & me!combobox
me.sfrmPEFactors.form.RecordSource = strSql
 
R

ragtopcaddy via AccessMonster.com

Albert,

Refresh did the trick! Thanks for your help.

Bill R
 

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