Updating a subform after data entry

Updating a subform after data entry

am 05.04.2008 21:31:55 von Presto

I have a Main form with a subform named Payments.
I have a button on the main form named NewPaymentEntry that opens a small
popup form to enter a new payment.
There is a "Save" , "Cancel", and "Close" button.

When I click "Close" I want it to automatically refresh the Payments subform
so I can see the new payment. How can I make this happen. (the interesting
thing is - it used to do this automatically before... but not any more....)

Here's the current "Close" code onclick event:
--------------------------------------------------------
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub
-----------------------------------------------------------

Any help for this VBA newbie would be greatly appreciated. :)
<3 Presto

Re: Updating a subform after data entry

am 06.04.2008 20:56:09 von Phil Stanton

Try

Private Sub cmdClose_Click()
DoCmd.Close
Forms!MainForm!Payments.Form.Requery
Exit Sub

Substitute your main form name for "MainForm" in the above

HTH

Phil

Don't think you need an error routine.
"Presto" wrote in message
news:5J-dne4xfq4hTmranZ2dnUVZ_jGdnZ2d@comcast.com...
>I have a Main form with a subform named Payments.
> I have a button on the main form named NewPaymentEntry that opens a small
> popup form to enter a new payment.
> There is a "Save" , "Cancel", and "Close" button.
>
> When I click "Close" I want it to automatically refresh the Payments
> subform so I can see the new payment. How can I make this happen. (the
> interesting thing is - it used to do this automatically before... but not
> any more....)
>
> Here's the current "Close" code onclick event:
> --------------------------------------------------------
> Private Sub cmdClose_Click()
> On Error GoTo Err_cmdClose_Click
> DoCmd.Close
> Exit_cmdClose_Click:
> Exit Sub
>
> Err_cmdClose_Click:
> MsgBox Err.Description
> Resume Exit_cmdClose_Click
>
> End Sub
> -----------------------------------------------------------
>
> Any help for this VBA newbie would be greatly appreciated. :)
> <3 Presto
>

Re: Updating a subform after data entry

am 08.04.2008 03:24:36 von Presto

Perfect!! This worked beautifully!
Thank you Phil.


"Phil Stanton" wrote in message
news:KMadnXaso9NZgWTanZ2dneKdnZydnZ2d@plusnet...
> Try
>
> Private Sub cmdClose_Click()
> DoCmd.Close
> Forms!MainForm!Payments.Form.Requery
> Exit Sub
>
> Substitute your main form name for "MainForm" in the above
>
> HTH
>
> Phil
>
> Don't think you need an error routine.
> "Presto" wrote in message
> news:5J-dne4xfq4hTmranZ2dnUVZ_jGdnZ2d@comcast.com...
>>I have a Main form with a subform named Payments.
>> I have a button on the main form named NewPaymentEntry that opens a
>> small popup form to enter a new payment.
>> There is a "Save" , "Cancel", and "Close" button.
>>
>> When I click "Close" I want it to automatically refresh the Payments
>> subform so I can see the new payment. How can I make this happen. (the
>> interesting thing is - it used to do this automatically before... but not
>> any more....)
>>
>> Here's the current "Close" code onclick event:
>> --------------------------------------------------------
>> Private Sub cmdClose_Click()
>> On Error GoTo Err_cmdClose_Click
>> DoCmd.Close
>> Exit_cmdClose_Click:
>> Exit Sub
>>
>> Err_cmdClose_Click:
>> MsgBox Err.Description
>> Resume Exit_cmdClose_Click
>>
>> End Sub
>> -----------------------------------------------------------
>>
>> Any help for this VBA newbie would be greatly appreciated. :)
>> <3 Presto
>>
>
>