Continuous subform problem

G

GD

I have a continuous subform that lists the credit memos that are related to
the debit memos from the main form. The problem I'm having is that a blank
record is saved to the credit memo table every time I view a record in the
main form that doesn't have a credit memo already listed in the subform.

I have a one (DM table) to many (CM table) relationship established. Can
anyone tell me what's going on?

Thanks!!!!!!
 
G

GD

I just realized I have some code that converts positive amounts to negative
automatically upon the users' entry:

Private Sub Form_Current()
Me.txtCMAmt = Abs(Me.txtCMAmt) * -1
Me.txt1500_ = Abs(Me.txt1500_) * -1
Me.txt2110_ = Abs(Me.txt2110_) * -1
Me.txt6100_ = Abs(Me.txt6100_) * -1

End Sub

Private Sub txt1500__AfterUpdate()
Me.txt1500_ = Abs(Me.txt1500_) * -1

End Sub

Private Sub txt2110__AfterUpdate()
Me.txt2110_ = Abs(Me.txt2110_) * -1

End Sub

Private Sub txt6100__AfterUpdate()
Me.txt6100_ = Abs(Me.txt6100_) * -1

End Sub

Private Sub txtCMAmt_AfterUpdate()
Me.txtCMAmt = Abs(Me.txtCMAmt) * -1

End Sub

Could this be why it's acting weird, and should I put a Me.NewRecord
criteria in there?
 
J

John Spencer MVP

Your code will dirty the record and so if there is a new record (blank) it
will be dirtied and then automatically saved.

You could add
If Me.NewRecord = False Then

Private Sub Form_Current()
If Me.NewRecord = False Then
Me.txtCMAmt = Abs(Me.txtCMAmt) * -1
Me.txt1500_ = Abs(Me.txt1500_) * -1
Me.txt2110_ = Abs(Me.txt2110_) * -1
Me.txt6100_ = Abs(Me.txt6100_) * -1
End if
End Sub

That may take care of the problem

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

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