Detail Form Scroll After Insert Record

  • Thread starter Thread starter Vensia
  • Start date Start date
V

Vensia

Dear all,

I put the following code at After_Update event of frmInvoiceDetail

Dim rs As DAO.Recordset
Dim strSQL As String
Dim curTotalAmount As Currency

strSQL = "SELECT * FROM tblInvoiceMain WHERE InvoiceNo = '" &
Me!InvoiceNo & "'"
curTotalAmount = Nz(DSum("Amount", "tblInvoiceDetail", "InvoiceNo = '" &
Me!InvoiceNo & "'"), 0)
Set rs = CurrentDb.OpenRecordset(strSQL)
With rs
.Edit
!TotalAmount = curTotalAmount
!Tax = !TotalAmount * 0.1
.Update
End With
rs.Close
Set rs = Nothing

Every time after I insert a new line of item, the Detail Form
(frmInvoiceDetail) will scroll and at the screen, I just can see the new
record. I should use the vertical scroll to see the existing lines of item
Why this happens ?
Thanks.

Vensia
 
Vensia,

Is it possible that your subform is set to SingleForm
instead of ContinuousForms? Check the DefaultView property
of the subform in its design view.

It sounds like either that is the problem or your subform
container is not long enough to display multiple records.
 
Gary,

Because the form contains details of item, so it should be viewed in
continuous form.
Actually, the form has enough height to display completely around 5 lines
of item.
Thanks.
 
Back
Top