Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CAN'T MAKE FORM RE-PAINT AFTER MAKING CHANGES

Status
Not open for further replies.

TNN

Programmer
Sep 13, 2000
417
US
I have txt boxes on a form that I load data into from a recordset using "txtbox=adoRs!field" in the form load event.

I am making changes to the recordset then re-loading the form to reflect changes made to the recordset. I cannot get the form to re-paint to reflect the new recordset. The new recordset is being created and loads properly in the form load event but can't get it to show on the screen.

I have tried to unload then load and/or show, used refresh. Nothing works, I can't get that newly loaded form from the form load event to re-paint or update on the screen. The old display continues to show.

I'm looking for any hints or suggestions. Thank you, any comments are appreciated.

TNN, Tom
TNPAYROLL@AOL.COM

TOM
 
Hi Tom

Why don't you create a Public Sub let say
LoadData on the form, and call it whenever you need to.

The only time this will not work is when you load the form with
MyForm.Show vbModal

So if this is the case do the following
Load MyForm 'This will run the form_load event
MyForm.LoadData
MyForm.Show vbModal


Hope this helps
Toyman :)
 
Hi Toyman,
Tried your suggestion, still can't make it work.

Weird happenings!! If I insert a couple of break points in the code and continue through them then the Form will display correctly. If I remove the break points and run the program then the Form will not display correctly. What! What! is happening!!

Anyone Help!! Please

TNN Tom
TNPAYROLL@AOL.COM

TOM
 
Try setting the AutoRedraw on the form to true ;) This should work, let me know.

Rob
 
Perhaps the transaction to your Database is not fast enough. Try to run your App as P-Code (Menu:project/Properties).

Kostarsus
 
The implication is that the update transaction is taking a little longer than the unloading and reloading of the form.

You could either deliberately build in a delay after issuing the Update - or use the fact that ADO objects have events, and wait until the RecordChangeComplete event occurs, eg:

Private WithEvents adoRS As ADODB.Recordset

Private Sub adoRS_RecordChangeComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
' Do whatever it is you need to do
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top