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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why are forms not updating until I advance the record? 1

Status
Not open for further replies.

number2

Technical User
Oct 25, 2001
284
US
Data is only being updated when I advance or reverse the data record and return to the original record. This happens when I input data in one form and move to a form which should show the data I had entered on the previous form. Any help would be appriciated.
 
You could add a Save Record command button, a command button with the property "Me.Requery" on the original form, or in the forms property, add the "Me.Requery" where you think it would work best. Another option is to have the form you are opening perform the requery of the original form in the On Unload property.

Private sub Form_UnLoad()
forms("frmName").requery
end sub

Sean.
 
I tried both the Me.Requeryand the Unload property event you mentioned; it didn't solve the update problem. I still have to advance the record and return in order to update the form. ANy other ideas? Thanks so much!
 
Either Me.Refresh or DoCmd.RunCommand acCmdSaveRecord
before opening the second form.
 
Are your forms based on queries or tables? It sounds as though they may be based on tables, which is why you are having this problem. Even then, you should be able to make a new macro which will first save the record, then open the other form. If they are not based on queries, redo the forms so they are. They will be much more versatile. Sean.
 
I had already built a HUGE multitab form based on a table (mistake). So converting it to a query based form would be very time consuming, unless anyone knows of a short cut.
I found good success with the Requery on the called form in the OnUnload event. :

Private Sub Form_Unload(Cancel As Integer)
forms("formname").Requery
End Sub

I am going to try the save method along with this to eliminate the need for the user to save prior to seeing the updated secondary form.
 
I may get scolded for this because there may be things going on underneath which I am unaware but.....

When I converted from forms based on tables to forms based on queries, I created the queries and created new forms based on those queries (do not use the form wizard). On the original form, I did an Edit, Select All, Copy, then pasted it into the new form based on my query. As long as the field names are the same, it will work. If they are different, then you can go into the properties and change the Control Source to the appropriate field.

Do this with all your subforms and forms, giving the new forms the names of the original forms. This will keep from having to change alot of other properties. You could add a "1" at the end of them so you can give that name to the new one. If something doesn't work out, you can take the "1" off the ends and reinstitute your original forms.

Sean.
 
That should work and I will try it. However as you know, any VB code is not copied when you copy and paste. (at least it has never copied in my experience). So that means individually copying each event code and pasting where it belongs, In the case of my form, that meas a great deal of time. I sure wish the VB code would copy/paste.
Thanks for all the help!
 
Is it really neccessary to copy & paste. Have you tried just changing the record source in the forms properties. As long as the query is based completely on the original tbl then you should be up and runnng. As the form is still complete the vb code in your form modules will still be there.

Let me know if I am mistaken. :-9
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top