Full Version: Arrrrrrghh! Subform Wont Update When Adding New Record!
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
hullstorage
Hi all,
I have attached a sample database to try and show what i mean!!

I have a form with a subform, when i click one of the records on the subform this open another extended form from a query that shows the full details of the record.

When the form opens i can change or add details to the record then when i close this form it requery the subform showing the changes. if any i have made.

Problem is, if a create a new record for the subform using the extended for it will not requery!! even when i save the record using a button.

I have to close the form that contains the subform and re-open it every time to show the new record??

Any ideas where i am going wrong

here are some of the codes i am using

THIS IS USED WHEN I CLICK ON THE RECORD OF THE SUBFORM
Private Sub DeliveryID_Click()
DoCmd.OpenForm "FrmViewExtendedDetails"
End Sub

THIS IS USED IN THE QUERY FOR THE EXTENDED FORM
[Forms]![FrmInvoice]![tblDeliveries subform]![deliveryid]

I USE THIS IF WHEN THE EXTENDED FORM IS OPENED WHICH ADDS THE INVOICE NUMBER FROM THE MAIN FORM
Private Sub Form_Open(Cancel As Integer)
If IsNull([InvoiceID]) Then
DoCmd.GoToRecord , , acNewRec

Me.InvoiceID = Forms!FrmInvoice!InvoiceID

End If


End Sub


THIS IS WHAT I USE WHEN CLOSING THE EXTENDED FORM TO REQUERY THE SUBFORM
Private Sub Form_Close()
If Not Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
[Forms]![FrmInvoice]![tblDeliveries subform]![DeliveryID].Requery



End If


End Sub


you may be best looking at the attached database and open the frminvoice form if you do not know what i mean

MANY THANKS
dustmopheadmop
Hi,
Your db can't be open, Please re upload it.
hullstorage
I have changed database to access 2003

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.