Requering a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I read a number of threads on the requery-issue, but I didn't get any
further in solving my own requery-question.
Requering (when, how and what) is a difficult issue for me.
Maybe someone can give me any specific help ?

My situation:
Form_A, with recordsource qQuery_A, with column ScorePoints
SubForm_B, with object txtScoreTotal,
with recordsource qQuery_B,
with column ScoreTotal:Sum(qQuery_A.ScorePoints)

For updating the column ScorePoints I received from the DiscussionGroup a
good working code (simplyfied for now):

Dim dbs As Database
Dim strSQL As String
Set dbs = CurrentDb()

strSQL = " Update tTable_A " & _
" SET tTable_A.ScorePoints = 1 WHERE .....(etc).....; "

dbs.Execute strSQL, dbFailOnError

dbs.Recordsets.Refresh

My question is:
What is the code to requery the column ScoreTotal in recordsource qQuery_B
under SubForm_B and, after that, how do I requery Subform_B ?
qQuery_B and SubForm_B only update when I close and re-open them !

Thanks anyone in advance
 
eric said:
I read a number of threads on the requery-issue, but I didn't get any
further in solving my own requery-question.
Requering (when, how and what) is a difficult issue for me.

My situation:
Form_A, with recordsource qQuery_A, with column ScorePoints
SubForm_B, with object txtScoreTotal,
with recordsource qQuery_B,
with column ScoreTotal:Sum(qQuery_A.ScorePoints)

For updating the column ScorePoints I received from the DiscussionGroup a
good working code (simplyfied for now):

Dim dbs As Database
Dim strSQL As String
Set dbs = CurrentDb()

strSQL = " Update tTable_A " & _
" SET tTable_A.ScorePoints = 1 WHERE .....(etc).....; "

dbs.Execute strSQL, dbFailOnError

dbs.Recordsets.Refresh

My question is:
What is the code to requery the column ScoreTotal in recordsource qQuery_B
under SubForm_B and, after that, how do I requery Subform_B ?
qQuery_B and SubForm_B only update when I close and re-open them !


Since queryB is sibformB's record source, you just need to
requery subformB. From formA the code to use right after
the Execute statement would be:
Me.SubForm_B.Form.Requery

I doubt that the line:
dbs.Recordsets.Refresh
is doing anything useful. Try removing it.
 
Hi Marshall,
You're right, after removing dbs.Recordsets.Refresh there's no
difference at all.
But the simple requery-code you gave me made all the difference!
Thank you for helping me out so quickly !
Greetings
 
Back
Top