Problem with the code

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

On my form i have a subforms ( frmManufacturePartsUsed ) also have a
button that will copy data into the subform when it is pressed. If data
already exists in the subform no data is copyed and error message

This was working but now i get the following error 'Application-defined
or object-defined error'

any idea why it does not work now

If Not IsNull(Me.frmManufacturePartsUsed.Form.ProductCode) Then (
ERROR on this Line)
MsgBox "Stock has already been Allocated.", vbInformation, "Stock
Allocated"
Exit Sub
End If

Me.Refresh
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70


DoCmd.SetWarnings False
DoCmd.OpenQuery "Query1"
DoCmd.SetWarnings True



Me.Refresh


End Sub
 
What changed? Upgrade to a new version or something?

Can you still run Query1?

Then there's DoCmd.DoMenuItem. That can cause problems as if the menu
changes, it stops working. Look for the appropriate DoCmd.RunCommand. To save
a record, this is it:

DoCmd.RunCommand acCmdSaveRecord
 
Back
Top