Identical code for generic functions not working

B

Brian Langley

Afternoon folks!

I've got 2 popup forms that trigger from NotInList events. This morning, I
got the first working ok- the Add and Cancel butons add or delete the new
record properly, the form requeries the original box putting the value in
the list- it works!

Unfortunatley, when I moved the code over to the second form (after changing
all the variables/form names etc) it isn't wotking properly. Specifically,
the second form's Add button will not save the data to the table.

Following are both forms bits of code:
The one that works:

**
Private Sub AddSupplier_Click()
RunCommand acCmdClose 'close form
End Sub

Private Sub Cancel_Click()
If Me.Dirty Then
Me.Undo 'Undo edits in progress
End If

If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord 'Delete new record
End If

RunCommand acCmdClose 'close form
End Sub
--
In the form's AfterUpdate event:

Forms!ApplicationDetails!Supplier.Requery 'Refresh combo box to accept new
supplier
**
And the one that doesn't:

**
Private Sub AddFundingSource_Click()
RunCommand acCmdClose 'close form
End Sub

Private Sub Cancel_Click()
If Me.Dirty Then
Me.Undo 'Undo edits in progress
End If

If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord 'Delete new record
End If

RunCommand acCmdClose 'close form
End Sub
--

In the forms AfterUpdate event:

Forms!FundingDetailsEntry.Requery 'Refresh combo box to accept new funding
source
**

Any help would be most appreciated.

Cheers
Brian
 
G

Guest

Brian,
In the forms AfterUpdate event:

Forms!FundingDetailsEntry.Requery 'Refresh combo box to accept new funding
source
**

It looks like you are missing something in the line above... maybe the combo
box name (or it could be the form name).

Otherwise, the code samples look the same.

If it still doesn't save the new record data, I'd recheck all of the control
names, then start adding breakpoints to see what is happening (or not
happening, as the case may be).

HTH
 

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