Form Updates Too Quickly

Hainesey

New member
Local time
Today, 22:44
Joined
Mar 12, 2003
Messages
6
I have a main form that displays all the information and lists all the ordered items. Clicking a button on the form opens a new form where a new item can be added. This works fine, but when Add Item is clicked on the second form the record is added and the form is then closed. But I also send a requery method to the main form to update the list of ordered items. This doesn't update the list with the new item. But I've added a temporary button on the main form that sends the command Me.Requery and if I wait 2-3 seconds after adding the item it is displayed.

The code in the Add Item button is -

Private Sub cmdAdd_Click()

Dim total As Currency
Dim dbOrders As Database
Dim rsOrders As DAO.Recordset

total = Me.txtCost * Me.txtQuantity

Set dbOrders = OpenDatabase(Application.CurrentProject.Path & "\Orders.mdb")
Set rsOrders = dbOrders.OpenRecordset("SELECT * FROM Order_Item")

With rsOrders
.AddNew
![Order#] = Me.txtOrderNo
!Catalogue_Code = Me.txtCode
!Item_Description = Me.txtDescription
!Unit_Cost = Me.txtCost
!Quantity = Me.txtQuantity
!Total_Cost = total
.Update
End With

rsOrders.Close
dbOrders.Close

Form_Order_Form.Requery
DoCmd.Close
Form_Order_Form.Requery

End Sub

I added the requery twice just to see if it made a difference requerying after the form is closed.

Thanks for any help.
 
thanks, but no difference.

It's still updating before the record has been properly updated.
 
Have you tried Me.Requery on the OnActivate event of the first form?
 

Users who are viewing this thread

Back
Top Bottom