D
David W. Fenton
"Pieter Wijnen"
<it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.
replace.with.norway> wrote in
The reason for that, as Pieter knows, is that "Name" is a reserved
word. Access often ignores this and manages to do what you expect,
but sometimes it fails to guess correctly what you mean, and you end
up with things that don't work. Because of that, it's best to avoid
using reserved words as names for objects in Access.
I always say this in response to bookmark navigation posts, but I've
never understood why one would set a recordset value like this
instead of using WITH:
With Me.RecordsetClone
.FindFirst "[Name] = '" & Me.NameDropDown.Value & "'"
If Not .NoMatch Then
If Me.Dirty Then Me.Dirty = False
Me.Bookmark = .Bookmark
End If
End With
(I've also added in saving the current record before moving to the
Bookmark, because there are cases in which the data won't get saved)
<it.isi.llegal.to.send.unsollicited.mail.wijnen.nospam.please@online.
replace.with.norway> wrote in
First Name is not a wise choice for a Control Name you should
change that
The reason for that, as Pieter knows, is that "Name" is a reserved
word. Access often ignores this and manages to do what you expect,
but sometimes it fails to guess correctly what you mean, and you end
up with things that don't work. Because of that, it's best to avoid
using reserved words as names for objects in Access.
Private Sub NameDropDown_AfterUpdate() ' No need for a button
really
Dim RsC As DAO.Recordset
If VBA.Len(Access.Nz(Me.NameDropDown.Value, VBA.vbNullString))>0
Then
Set RsC=Me.RecordsetClone
RsC.FindFirst "[Name] = '" & Me.NameDropDown.Value & "'"
If Not RsC.NoMatch Then
Me.BookMark=RsC.BookMark
End If
End If
Set RsC = Nothing
End Sub
I always say this in response to bookmark navigation posts, but I've
never understood why one would set a recordset value like this
instead of using WITH:
With Me.RecordsetClone
.FindFirst "[Name] = '" & Me.NameDropDown.Value & "'"
If Not .NoMatch Then
If Me.Dirty Then Me.Dirty = False
Me.Bookmark = .Bookmark
End If
End With
(I've also added in saving the current record before moving to the
Bookmark, because there are cases in which the data won't get saved)