fraser_lindsay
Access wannabe
- Local time
- Today, 17:59
- Joined
- Sep 7, 2005
- Messages
- 218
Hi,
I have a form with a subform. On the subform I have a combo. In the not in list of that combo I trigger a second form as popup dialog to enter a new combo option, along with some linked fields.
When the user clicks the 'close' command button it closes that form and returns them to the original form which is still open.
I woudl like th combo to be requeried so the new item added now appears without having to close and reload the form.
I already have this in operation on other forms, although in a slightly different setup. I use this code:
That doesn't work for some reason so I have tried lots of different combination and locations for the code yet none seem to be able to requery the subform on the main form while open and I cannot see why.
My most recent attempt is this different code on the close button:
Can anyone help please?
I have a form with a subform. On the subform I have a combo. In the not in list of that combo I trigger a second form as popup dialog to enter a new combo option, along with some linked fields.
When the user clicks the 'close' command button it closes that form and returns them to the original form which is still open.
I woudl like th combo to be requeried so the new item added now appears without having to close and reload the form.
I already have this in operation on other forms, although in a slightly different setup. I use this code:
Code:
Dim frm As Form 'This code requeries and refreshes all open forms in the current project
For Each frm In Application.Forms
If IsLoaded(frm.Name) = True Then
' requery and then refresh the form
frm.Requery
frm.Refresh
End If
Next frm
That doesn't work for some reason so I have tried lots of different combination and locations for the code yet none seem to be able to requery the subform on the main form while open and I cannot see why.
My most recent attempt is this different code on the close button:
Code:
Private Sub cmdClose_Click()
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdSaveRecord
Me.Requery
Me.Refresh
DoCmd.Close
Form![frmHazards_Subform].Requery
End Sub
Can anyone help please?