Combo Box Requery

Bob M

Registered User.
Local time
Today, 06:04
Joined
Sep 11, 2002
Messages
42
I have a form [Purchase Orders] and a subform [Purchase Orders Subform]. On the 1st form I have a combo box from which the user can select from a list of suppliers. On the subform there is a combo box from which the user can select from a list of products sold by the supplier chosen above. If the user enters a new product a message box appears asking them if they want ot add the new record. If they respond yes a product entry form opens and the user fills in the data. After the user finished with the new product entry, I run some VBA code in the afterupdate event to add a record with the productid and supplierid to a join table. I put the following requery after the code which added the new record in the afterupdate event.
Forms![Purchase Orders]![Purchase Orders Subform].Form![ProductID].Requery.
When I exit the entry form I get a message box stating that I need to save the record before requerying.

Where do I need to requery the combo box on the subform.

Thanks for you help.
 
When you close the "new" product form, requery the subform combo box.
 
If you mean put the requery in the OnClose action of the entry form, that doesn't work either. I still get the error:


You must save the current field before you run the requery action.

I seem to get this error no matter where I put it.
 
Requery

I found it!!! I used some old code I had where the requery worked and used it in the notonlist event and it worked!!!

Thanks for your help.
 
Could you post the code you used? I'm having a similar problem.
 
Here is the code taken from this site btw.

Private Sub ProductID_DblClick(Cancel As Integer)
On Error GoTo Err_ProductID_DblClick
Dim lngProductID As Long

If IsNull(Me![ProductID]) Then
Me![ProductID].Text = ""
Else
lngProductID = Me![ProductID]
Me![ProductID] = Null
End If
DoCmd.OpenForm "ProductEntry", , , , , acDialog, "GoToNew"
Me![ProductID].Requery
If lngProductIDID <> 0 Then Me![ProductID] = lngProductID

Exit_ProductID_DblClick:
Exit Sub

Err_ProductID_DblClick:
MsgBox Err.Description
Resume Exit_ProductID_DblClick

End Sub

The requery happens right after returning from adding the new record.

Hope this helps.


From the land of the frozen chosen
 

Users who are viewing this thread

Back
Top Bottom