ODBC Call Failed

M

Mark A. Sam

This error is causing my client's entry girl more problems then piranha in a
hottub.

Since switching to SQL Server as a backend, this error pops up unexpectedly.
If she closes and reopens the DB, it clears up. I can't seem to reproduce
it. Here is a procedure which has been acting up only in the last couple of
days. Maybe someone can see something that could be an issue. This is
button off of a subform. [Shipping] is the underlying table for the subform
Originally, when Access was the backend, I was able to address
RecordsetClone, but have had to adjust my methods whereever I add a record
to a recordset variable.

The procedure bombs out before the line:

[ShipDate].SetFocus

After the ODBS error message, she gets another error:

"Microsoft Access can't move the focus to the control ship date. "

I don't know why [Ship Date] cannot get the focus, cecause it is enabled.
I have had times when the update method has failed, but that isn't the case
here. When she reopens the DB, the new record is intact.


Any ideas would be appreciated.



Private Sub Add_Record_Click()
On Error GoTo error_Section

If Not IsLoaded("order shipping form") Then
MsgBox "You cannot Add Record unless it is thru the Shipping Form"
Exit Sub
End If

Dim rs As Recordset
Dim criteria As String

Set rs = CurrentDb.OpenRecordset("Shipping", dbOpenDynaset, dbSeeChanges)

rs.AddNew
rs![ShipID] = NEXTShipID() + 1
rs![ordID] = Parent![ordID]
rs![ShipDateShipped] = Date
rs![ShipEmpNo] = Parent.[EmployeeNumber]
rs![jobID] = Parent.[ordJob]
rs![ShipCarrier] = Parent.[ordCarrierName1]
rs![ShipMethod] = Parent.[ordCarrierMethod1]
rs![ShipAcct] = Parent.[ordShipAccount1]
rs![ShipFreightPaymentType] = Parent.[ordCustFreightPaymentType]
rs.Update

Me.Requery

Parent.[not shipped].Requery
Parent.[Shipped].Requery


[ShipDate].SetFocus

'This added here becuase Bookmark wasn't recogized above.
Set rs = Me.RecordsetClone

criteria = "[ShipId] = " & NEXTShipID()
rs.FindFirst criteria
If Not rs.NoMatch Then
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing

DoCmd.RunCommand acCmdSaveRecord

exit_Section:
Exit Sub

error_Section:
MsgBox Err.Description
'Resume exit_Section
Resume Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top