Records are added to table, but not form in VBA

G

gwengrofsky

Hello,
I have a form class module that uses the doCmd.RunSQL statement.
The first two work, but immediatly following in a call to another
subroutine I have a disconnected recordset that is updated with new
records and finally a rsSummary.UpdateBatch statement. The new
records are put in the table, but when I return from the subroutine,
the Me.recordsouce = "qrySummary" statement which gets run, doesn't
show the new records. Only when I exit 'that' form and come back are
they there. I checked, and they are also in the table everytime. How
can I show the updated records in the table without exiting the form.
I tried Me.refresh, Me.repaint, but maybe I'm using it wrong somehow.
I think I close the recordset and connection too correctly by
'myconnection.close' and 'Set rsSummary = nothing'. Also, I stepped
over the add record subroutine, and when It's not called the
doCmd.RunSQL statement that followed worked properly but of course
there were no new records to add; only the records I put in there to
test it. The RunSQL statement is a append query that append the new
updatedbatch table to another table that will be queried to
(hopefully) show the records.
Thanks for reading and helping.
Gary
 
G

gwengrofsky

Hello,
I have a form class module that uses the doCmd.RunSQL statement.
The first two work, but immediatly following in a call to another
subroutine I have a disconnected recordset that is updated with new
records and finally a rsSummary.UpdateBatch statement. The new
records are put in the table, but when I return from the subroutine,
the Me.recordsouce = "qrySummary" statement which gets run, doesn't
show the new records. Only when I exit 'that' form and come back are
they there. I checked, and they are also in the table everytime. How
can I show the updated records in the table without exiting the form.
I tried Me.refresh, Me.repaint, but maybe I'm using it wrong somehow.
I think I close the recordset and connection too correctly by
'myconnection.close' and 'Set rsSummary = nothing'. Also, I stepped
over the add record subroutine, and when It's not called the
doCmd.RunSQL statement that followed worked properly but of course
there were no new records to add; only the records I put in there to
test it. The RunSQL statement is a append query that append the new
updatedbatch table to another table that will be queried to
(hopefully) show the records.
Thanks for reading and helping.
Gary

********** NO REPLY NECESASRY, i FIGURED IT OUT *****
I searched around and winded up using set rsSummary =
Me.recordSetClone
That eventually worked, when I coded some other stuff.
Thanks, anyway
Gary
 
M

missinglinq via AccessMonster.com

Instead of Me.refresh or Me.repaint you should have used Me.Requery.
 

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