Quote:
quote:Originally posted by mydnyght
All the tables involved do have primary keys set.
:( this is frustrating
|
I had a similar problem. What I did was create my own navigation buttons and then wrote a code in the Form_Current as follows:
Private Sub Form_Current()
Dim recClone As ADODB.Recordset
'Make a clone of the recordset underlying the form so
'we can move around that without affecting the form's
'recordset
Set recClone = Me.RecordsetClone
'If we are in a new record, disable the NEXT button
'and enable the rest of the buttons
If Me.NewRecord Then
cmdFirst.Enabled = True
cmdPreviousRec.Enabled = True
cmdNext.Enabled = False
cmdLast.Enabled = True
cmdNew.Enabled = True
Exit Sub
End If
'If we reach here, we know we are not in a new record
'so we can enable the NEW button if the form allows
'new records to be added
If recClone.RecordCount = 0 Then
cmdFirst.Enabled = False
cmdNext.Enabled = True
cmdPreviousRec.Enabled = False
cmdLast.Enabled = False
Else
'If there are records, we know that the FIRST and
'LAST buttons will always be enabled, irrespective
'of where we are in the recordset
cmdFirst.Enabled = True
cmdLast.Enabled = True
'Synchronize the current pointer in the two recordsets
recClone.Bookmark = Me.Bookmark
'Next, we must see if we are on the first record
'If so, we should disable the PREVIOUS button
With recClone
.MovePrevious
cmdPreviousRec.Enabled = Not (recClone.BOF)
.MoveNext
'and then check whether we are on the last record
'If so, we shoudl disable the NEXT button
.MoveNext
cmdNext.Enabled = Not (recClone.BOF)
.MovePrevious
End With
End If
'And finally close the cloned recordset
recClone.Close
End Sub
After doing this I was able to navigate through the records and also add records. Hope this helps.
slypunk