Forms and Classes

I have created a Master Detail form which uses a class module to add, edit ect.

I need to do some processing using sql on pressing the Update Button.

The sql does the processing ok, which effects my class (e.g. subsumes the detail lines from 4 lines to 1 line).

The problem I have got is that unless I drop the class and create a new one then the changes do not become evident on the screen.

Is there a way to refresh the class without having to close the class and recreate it.

I have tried:
 Primarycls.requery  
 form.refresh
 

Thanks For Your Help,  
kenmckAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BennyBunnyCommented:
does your class have a requery method
where is the data visualized
which part of the form / class writes the data ..?
0
rovermCommented:
Write a sub in your class to re-initialize all lines and call that sub (ok, method) after your sql statement.
0
kenmckAuthor Commented:
The class is the default class created by forms design wizard.

Id does have a requery method as below:

Public Sub Requery()
  DoingRequery = True
  DataMemberChanged "Primary"
  DataMemberChanged "Secondary"

  adoPrimaryRS.Requery

  DoingRequery = False
  DataMemberChanged "Primary"
  DataMemberChanged "Secondary"
End Sub

The data is displayed on screen and on pressing the update button the processing takes place subsuming 4 lines into 1, which it does in the Access database.

The problem is the form still displays the 4 lines, even though 3 of them do not exist. If I close the class and recreate it will then show the changes, but this does not seam to be very efficient.

I hope this helps.

Thanks,
0
rovermCommented:
You can also try to close the connection and re-open it before your adoPrimaryRS.Requery line.
0
BennyBunnyCommented:
maybe you have do rewrite the textcontrols(or in whatever style u display the data) with the data from the recordset to refill after updating the recordset.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.