insert sql form-subform problem

J

Junior

hi,
i'am using ac2003 and i've a problem with a form wich has a subform.
On the mainform i tried to add a record, with a commandbutton, in the
subform but i have to run the sql twice before the record is shown in the
subform. The mainform is based on then tblOrder and the subform is based on
tblDelivery
My code is as below :
'********
Dim sql As String
docmd.save ' to save the changes on the mainform
sql = "insert into TblDelivery(DelivOrderNr,DelivEmpl,DeliverStatus) SELECT
tblOrder.OrderID,tblOrderEmpl,tbl.OrderStatus FROM tblOrder WHERE
tblOrder.OrderID=" & Me.orderID

DoCmd.Save
DoCmd.RunSQL (sql)
frmOrderSub.Requery
Me.Refresh
' i cannot do a refresh of the subform, only fo the main form ?
'************
Wat i'a doing wrong ? After i ran the sql , the instruction is still in
memory because when i change the deliverystatus in the mainform , the former
value is added and shown in the subform ?


many regards, Junior
 

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