Data Saving
The issue is based on this code below:
----- start of function code -----
Public Function LimitRecords( _
frm As Access.Form, _
Optional RecLimit As Integer = 1)
' Limit the number of records in the form passed as
' to no more than the number specified by .
With frm.RecordsetClone
If .RecordCount <> 0 Then .MoveLast
frm.AllowAdditions = (.RecordCount < RecLimit)
End With
End Function
'----- end of function code -----
=LimitRecords([Form], 1)
Because of using this code to limit the number of lines to be used in the sub form, though everything works fine but after saving data it does not refresh in readiness for the new data entry until I close the form and reopen again that is when it work again.
I have tried to use this code:
Me.Requery
In the sub form, well it has worked but it save directly immediately once the last control is done leaving the parent form data un saved. It does not give chance for corrections
Temporally I have now resorted to us the VBA code below:
Private Sub Refresh_Click()
DoCmd.Save
DoCmd.Close
End Sub
This now works Okay, but I have to keep on reopening until all transactions are finished
(2) Is there way to refer to a control from a subform to the other subform like the we do it when referring to the parent form:
Me.TTDate = Me.Parent!TTDate
Any help on this will be high appreciated.
Regards
Chris
----- start of function code -----
Public Function LimitRecords( _
frm As Access.Form, _
Optional RecLimit As Integer = 1)
' Limit the number of records in the form passed as
' to no more than the number specified by .
With frm.RecordsetClone
If .RecordCount <> 0 Then .MoveLast
frm.AllowAdditions = (.RecordCount < RecLimit)
End With
End Function
'----- end of function code -----
=LimitRecords([Form], 1)
Because of using this code to limit the number of lines to be used in the sub form, though everything works fine but after saving data it does not refresh in readiness for the new data entry until I close the form and reopen again that is when it work again.
I have tried to use this code:
Me.Requery
In the sub form, well it has worked but it save directly immediately once the last control is done leaving the parent form data un saved. It does not give chance for corrections
Temporally I have now resorted to us the VBA code below:
Private Sub Refresh_Click()
DoCmd.Save
DoCmd.Close
End Sub
This now works Okay, but I have to keep on reopening until all transactions are finished
(2) Is there way to refer to a control from a subform to the other subform like the we do it when referring to the parent form:
Me.TTDate = Me.Parent!TTDate
Any help on this will be high appreciated.
Regards
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Chris,
You had two people working with you on this question. I believe Gustav’s post addressed the bulk of your question; mine addressed your second concern.
Please use the Request Attention button to reopen the question, and accept/award points to the first post.
Thanks -
You had two people working with you on this question. I believe Gustav’s post addressed the bulk of your question; mine addressed your second concern.
Please use the Request Attention button to reopen the question, and accept/award points to the first post.
Thanks -
ASKER
I'm sorry I cannot see the re open button but all the same what worked perfectly well for me is as follows:
Replace re query with three staged code:
Private Sub Refresh_Click()
DoCmd.Save
DoCmd.Close
DoCmd.Open Form
End Sub
The above code worked very with the code below:
Public Function LimitRecords( _
frm As Access.Form, _
Optional RecLimit As Integer = 1)
' Limit the number of records in the form passed as
' to no more than the number specified by .
With frm.RecordsetClone
If .RecordCount <> 0 Then .MoveLast
frm.AllowAdditions = (.RecordCount < RecLimit)
End With
End Function
Once see the re open button I will do as per request many thanks to all.
Regards
Chris
Replace re query with three staged code:
Private Sub Refresh_Click()
DoCmd.Save
DoCmd.Close
DoCmd.Open Form
End Sub
The above code worked very with the code below:
Public Function LimitRecords( _
frm As Access.Form, _
Optional RecLimit As Integer = 1)
' Limit the number of records in the form passed as
' to no more than the number specified by .
With frm.RecordsetClone
If .RecordCount <> 0 Then .MoveLast
frm.AllowAdditions = (.RecordCount < RecLimit)
End With
End Function
Once see the re open button I will do as per request many thanks to all.
Regards
Chris
Open in new window
(Where OtherChild is the name of the 'sibling' subform control, as seen in the parent form's design)