Access 2007 "no current record" on split form

P

Preston

Hi,
I am using VBA in Access 2007 to have a split form with a searchable text
box. On new record entry the code will search for an existing entry in the
recordset clone and if it exists will undo the control's changes and then set
the form's bookmark to the found record's bookmark. This all work fine if the
value is entered on the form half of the split form but if it is entered on
the datasheet portion then I am given a "No current record" message box or a
"Property not found" message box. It still finds the record but shows these
message boxes after the code is finished executing. The error is not in the
code and I am not given a debug option.
The form has two subforms.
Thank you for any help you can give.

Preston

UPDATE:
i have recreated the error with a simple database that has 2 tables parent
and child and a split form based on parent that has a subform based on child.
The following code is running on "current" event of the control containing
the value searched for.

<code>
Private Sub ID_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Dim so As String
Dim result As VbMsgBoxResult

If Me.NewRecord Then
Set rst = Me.RecordsetClone
Key = ID
rst.FindFirst ("ID = " & ID)

If Not rst.NoMatch Then
Cancel = True
Me.Undo
Me.Bookmark = rst.Bookmark
Me.Refresh
End If
Else
If Not IsNull(SvcOrderNum) And Not IsEmpty(SvcOrderNum) And _
TempVars!sonum1 <> SvcOrderNum Then

result = MsgBox("You are about to change the ticket number." &
vbCrLf & _
"Continue?.", vbYesNo, "Confirm change...")
If result = vbNo Then
Me.SvcOrderNum.Undo
DoCmd.RunCommand acCmdUndo
End If
End If
End If
End Sub
</code>
 
P

paleshire

UPDATE:

The problem seems to be inconsistent. Sometimes it tells me "Property not
found" in a general windows exclamation box with just an OK button and
sometimes i get the other error "No current record". I have hooked into
multiple events in the main form and subform with break points and debug.
print statements to try to see when it happens and it does not occur in the
range of any of the events that I am monitoring. Here are the events:

Activate
AfterFinalRender
AfterUpdate
BeforeQuery
BeforeUpdate
Current
GotFocus
Load
Open
Query
 

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