After Update issue

T

Tara

I have a parent form (frmCustomers) with Customer Contact information and a
subform to track receipts for those customers. On the parent form, I have a
combo box which has the On Not In List event set to open a form
(frmAddCustomer) where users can add a new customer. This all works fine.
But what isn't working fine is the After Update event. What I currently have
is the After Update event in the combo box on the main form set to refresh
the data on the parent form. But it's not working. Here is the code I have
for both the Not In List event and the After Update event:

Private Sub CboCustomer_NotInList(NewData As String, Response As Integer)
Dim strMsg As String

strMsg = "'" & NewData & "' is not currently in the list of businesses "
& vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add this business to the current list?"

If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new business?") = vbYes Then
Response = acDataErrContinue

DoCmd.OpenForm "frmAddCustomer", , , , , acDialog
Response = acDataErrAdded

End If

End Sub


Private Sub CboCustomer_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[CustID] = " & Str(Me![CboCustomer])
Me.Bookmark = rs.Bookmark

Me.sbfReceipts.Requery
Me.sbfReceipts.SetFocus
DoCmd.GoToRecord , , acNewRec

End Sub


What I'm really wondering though is if I shouldn't do something when
frmAddCustomers closes to refresh the parent form data, rather than having
something in the AfterUpdate event in the combo.

Any suggestions or advice is appreciated!
 
N

NetworkTrade

it seems your self diagnosis is correct; once you've added a new customer -
- if you were to simply close and reopen that parent form that customer is
displayed with all the others?? if so then yes; you need to refresh that
parent form...
if not; then there is something else still to resolve...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top