Error after VBA Insert - Microsoft access cannot find a record.

  • Thread starter Thread starter Stormrider
  • Start date Start date
S

Stormrider

I have an insert function on a form in VBA (see below).

When I try to insert a record the record is displayed on form but the
following error message pops up:

The Microsoft Office Access Database Engine cannot find a record in the
table...

When I ok and quit Access I get the usual you cannot save the record at this
time. If I close and reenter the form the record IS saved and there.

My code is below, any ideas?

Thanks!

Private Sub Greenhouse_AfterUpdate()

Dim mSQLCmd As String
mSQLCmd = "INSERT INTO Production_Run_Greenhouses VALUES ('" & Me.Text10 &
"','" & Me.Greenhouse & "'," & "1" & ")"
CurrentDb.Execute mSQLCmd

End Sub
 
I should add that the form is based on a query and the INSERT, updates two
tables which combined form the query. Only information from one table is not
found the other is but both tables are updated.
 
Back
Top