Detail Form Scroll After Insert Record

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
 
G

Gary Miller

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.
 
V

Vensia

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.
 

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