bookmark not working anymore

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has a combo box, which has the list of project names in
the Project table and when the user chooses one of them, the fields that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago, and the
changes I've made since then are adding 3 command buttons which each of them
ables/disables the Visible property of various components of the form.
Basically it makes different parts of the table appear and disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark stays
empty. The early version of the db I have works fine with the same code.

Any suggestions or help will be greatly appreciated!
 
first issue; Name should not be used as a Name. It is a reserved word and
even when enclosed in brackets can cause Access some confusion. Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub
 
Thank you for your response-

I didn't know there were 'reserved' names in access, and I changed the field
name to something different and I've placed your code accordingly. I guess it
solved a part of the problem.

When I open the db file with shift+click to go into the devloper mode, the
code works fine - the combo box pulls up the correct record. But when I open
the db file by just double-clicking(without and devlopment tool menu) it
tells me it cannot find the record! The code doesn't break, it's just not
finding what's there. What's even weirder is that there is another combo box
that uses the exact same procedure, it works fine...


Klatuu said:
first issue; Name should not be used as a Name. It is a reserved word and
even when enclosed in brackets can cause Access some confusion. Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


dave said:
I have a form that has a combo box, which has the list of project names in
the Project table and when the user chooses one of them, the fields that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago, and the
changes I've made since then are adding 3 command buttons which each of them
ables/disables the Visible property of various components of the form.
Basically it makes different parts of the table appear and disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark stays
empty. The early version of the db I have works fine with the same code.

Any suggestions or help will be greatly appreciated!
 
It is possible you have some corruption going on.
--
Dave Hargis, Microsoft Access MVP


dave said:
Thank you for your response-

I didn't know there were 'reserved' names in access, and I changed the field
name to something different and I've placed your code accordingly. I guess it
solved a part of the problem.

When I open the db file with shift+click to go into the devloper mode, the
code works fine - the combo box pulls up the correct record. But when I open
the db file by just double-clicking(without and devlopment tool menu) it
tells me it cannot find the record! The code doesn't break, it's just not
finding what's there. What's even weirder is that there is another combo box
that uses the exact same procedure, it works fine...


Klatuu said:
first issue; Name should not be used as a Name. It is a reserved word and
even when enclosed in brackets can cause Access some confusion. Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


dave said:
I have a form that has a combo box, which has the list of project names in
the Project table and when the user chooses one of them, the fields that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago, and the
changes I've made since then are adding 3 command buttons which each of them
ables/disables the Visible property of various components of the form.
Basically it makes different parts of the table appear and disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark stays
empty. The early version of the db I have works fine with the same code.

Any suggestions or help will be greatly appreciated!
 
Oh well, I'll figure something out.
Thanks for your help though-

-dave

Klatuu said:
It is possible you have some corruption going on.
--
Dave Hargis, Microsoft Access MVP


dave said:
Thank you for your response-

I didn't know there were 'reserved' names in access, and I changed the field
name to something different and I've placed your code accordingly. I guess it
solved a part of the problem.

When I open the db file with shift+click to go into the devloper mode, the
code works fine - the combo box pulls up the correct record. But when I open
the db file by just double-clicking(without and devlopment tool menu) it
tells me it cannot find the record! The code doesn't break, it's just not
finding what's there. What's even weirder is that there is another combo box
that uses the exact same procedure, it works fine...


Klatuu said:
first issue; Name should not be used as a Name. It is a reserved word and
even when enclosed in brackets can cause Access some confusion. Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


:

I have a form that has a combo box, which has the list of project names in
the Project table and when the user chooses one of them, the fields that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago, and the
changes I've made since then are adding 3 command buttons which each of them
ables/disables the Visible property of various components of the form.
Basically it makes different parts of the table appear and disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark stays
empty. The early version of the db I have works fine with the same code.

Any suggestions or help will be greatly appreciated!
 
I've been stumbling over this for 2-3hrs now. I have a forme and all I'm
trying to do is get a RecordSetClone and I keep getting "Runtime error 3021
"No current record""

Here is the code I've been testing:
Dim rs As Recordset
Set rs = Me.RecordsetClone
Debug.Print rs!fieldName

As soon as it gets to the debug statement it throws the error. I tested the
recordcount and eof and both are valid. But, anytime I refrerence any field
I get the 3021 error. Makes no sense and now i've wasted 3hrs trying to do
something I use everyday without any problems.

Any ideas

Klatuu said:
It is possible you have some corruption going on.
--
Dave Hargis, Microsoft Access MVP


dave said:
Thank you for your response-

I didn't know there were 'reserved' names in access, and I changed the field
name to something different and I've placed your code accordingly. I guess it
solved a part of the problem.

When I open the db file with shift+click to go into the devloper mode, the
code works fine - the combo box pulls up the correct record. But when I open
the db file by just double-clicking(without and devlopment tool menu) it
tells me it cannot find the record! The code doesn't break, it's just not
finding what's there. What's even weirder is that there is another combo box
that uses the exact same procedure, it works fine...


Klatuu said:
first issue; Name should not be used as a Name. It is a reserved word and
even when enclosed in brackets can cause Access some confusion. Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


:

I have a form that has a combo box, which has the list of project names in
the Project table and when the user chooses one of them, the fields that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago, and the
changes I've made since then are adding 3 command buttons which each of them
ables/disables the Visible property of various components of the form.
Basically it makes different parts of the table appear and disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark stays
empty. The early version of the db I have works fine with the same code.

Any suggestions or help will be greatly appreciated!
 
RainMan said:
I've been stumbling over this for 2-3hrs now. I have a forme and all I'm
trying to do is get a RecordSetClone and I keep getting "Runtime error
3021
"No current record""

Here is the code I've been testing:
Dim rs As Recordset
Set rs = Me.RecordsetClone
Debug.Print rs!fieldName

As soon as it gets to the debug statement it throws the error. I tested
the
recordcount and eof and both are valid. But, anytime I refrerence any
field
I get the 3021 error. Makes no sense and now i've wasted 3hrs trying to
do
something I use everyday without any problems.

Any ideas

Klatuu said:
It is possible you have some corruption going on.
--
Dave Hargis, Microsoft Access MVP


dave said:
Thank you for your response-

I didn't know there were 'reserved' names in access, and I changed the
field
name to something different and I've placed your code accordingly. I
guess it
solved a part of the problem.

When I open the db file with shift+click to go into the devloper mode,
the
code works fine - the combo box pulls up the correct record. But when I
open
the db file by just double-clicking(without and devlopment tool menu)
it
tells me it cannot find the record! The code doesn't break, it's just
not
finding what's there. What's even weirder is that there is another
combo box
that uses the exact same procedure, it works fine...


:

first issue; Name should not be used as a Name. It is a reserved
word and
even when enclosed in brackets can cause Access some confusion.
Avoid using
any Access reserved words.

Try this version:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.

With Me.Recordset.Clone
.FindFirst "[Name] = '" & Me![Combo89] & "'"
If .NoMatch Then
Me![Combo89] & " Was Not Found"
Else
Me.Bookmark = .Bookmark
End If
End With
End Sub


--
Dave Hargis, Microsoft Access MVP


:

I have a form that has a combo box, which has the list of project
names in
the Project table and when the user chooses one of them, the fields
that are
related to the project gets populated.

The problem is that it was working fine until couple of days ago,
and the
changes I've made since then are adding 3 command buttons which
each of them
ables/disables the Visible property of various components of the
form.
Basically it makes different parts of the table appear and
disappear and the
combo box that is causing the problem is part of that too.

The code is as follows:

Private Sub Combo89_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo89] & "'"
Me.Bookmark = rs.Bookmark
End Sub

When I choose a project in the combo box, it gives me
"Run-time error '3021':
No current record.

I'm kinda new to the whole VB coding, but it seems like Me.Bookmark
stays
empty. The early version of the db I have works fine with the same
code.

Any suggestions or help will be greatly appreciated!

Make sure you have a reference set to the DAO library "Microsoft DAO 3.x
Object Library". Also, in case you have a reference to ADO ("Microsoft
ActiveX Data Objects 2.x Library", change this line:

Dim rs As Recordset
to:
Dim rs As DAO.Recordset

An Access form's Recordsetclone is a DAO Recordset object.
 
Back
Top