|
From: Stormrider on 4 Jul 2008 03:30 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
From: Stormrider on 4 Jul 2008 04:04 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. "Stormrider" wrote: > 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
|
Pages: 1 Prev: passing SQL commands as text to variable Next: Select Subform based on Current Data |