Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The refresh method, having some problems

Status
Not open for further replies.

DanEaton

Technical User
Jun 24, 2002
60
CA
I have a catalog data entry form with multiple required fields on it. Some of them are catalog date, product, vendor, and so on...anyway, i want to have the user-option of adding a new vendor by clicking on a button. This button would activate a vendor data entry form. Now, I know how to link everything and have already done so. The problem lies with the "return to catalog form with update" button. Its purpose is to return to the catalog entry form with the information that was updated so that a user can pick out that vendor from the combo box. I had tried the repaint function at first, then realized that it doesn't do what I want, so I am trying the refresh method. I wrote

Forms!frmCatalogDataEntry.refresh

for the click property of the button. When it returns to the form, I get a message box saying "the field VendorID can't contain a null value because the required property is set to true"...I find that if the focus is not yet on that field when I hit the Add New Vendor button, all is well, however, if the focus is on it or if other fields are full, the message appears. Can anyone see a way around this? Dan Eaton
deaton@caemachinery.com
 
Are you making sure that the record is actually saved when you refresh? Until the new entry form is closed, it won't save the record on its own.
Here's something you can try:

DoCmd.RunCommand acCmdSave
Form_frmCatalogDataEntry.Requery
Form_frmCatalogDataEntry.RecordsetClone.FindFirst "VendorID = '" & Me.VendorID & "'"
Form_frmCatalogDataEntry.Bookmark = Form_frmCatalogDataEntry.RecordsetClone.Bookmark
DoCmd.Close

If this particular code doesn't work, it still gives an idea of something you can use. You may need a recordset to make it work, but that shouldn't be the case. You can also shift the focus to Form_frmCatalogDateEntry to do the refreshing, then
DoCmd.Close acForm, Me.Name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top