Not a valid bookmark

  • Thread starter Thread starter Mark A. Sam
  • Start date Start date
M

Mark A. Sam

In the following snippet, where I add a record then do a find I get a
message,

Not a Valid Bookmark.

This is from a button in a subform. The table Shipping is the underlying
recordsouce for the form.

The table is a linked SQL Server table, and the line,

rs![ShipID] = NEXTShipID() + 1

Is forcing the next number to an Identity Field which was formerly an
Autonumber field when Shipping was an Access table. This assigns ok, but I
need to bring the new record up after I created and populate it. I can't do
that unless I requery the subform (Shift-F9) or close and reopen the
subform.

The Me.Requery statement before the FindFirst method doesn't do anything.

Dim rs As Recordset
Dim Criteria As String

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

rs.AddNew
'Criteria = "[ShipID] = " & rs![ShipID]
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

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


I am really confused and concerned using SQL tables. I deleted a record in
the subform and a mess of records disappeared from the table. They didn't
appear when I opened the linked table, nor when I opened the table usijng
the enterprise manager. However suddenly one of the records that I thought
I had lost appreared but disappeared again. Initially records appeared in
the form but not in the table, until I closed the main form and opened it.
It is if they exist, but are invisible.

God Bless,

Mark A. Sam
 
Back
Top