Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / October 2007

Tip: Looking for answers? Try searching our database.

bookmark not working anymore

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dave - 05 Oct 2007 19:52 GMT
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!
Klatuu - 05 Oct 2007 19:58 GMT
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

Signature

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
[quoted text clipped - 25 lines]
>
> Any suggestions or help will be greatly appreciated!
dave - 05 Oct 2007 21:30 GMT
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
[quoted text clipped - 44 lines]
> >
> > Any suggestions or help will be greatly appreciated!
Klatuu - 05 Oct 2007 21:47 GMT
It is possible you have some corruption going on.
Signature

Dave Hargis, Microsoft Access MVP

> Thank you for your response-
>
[quoted text clipped - 57 lines]
> > >
> > > Any suggestions or help will be greatly appreciated!
dave - 05 Oct 2007 22:03 GMT
Oh well, I'll figure something out.
Thanks for your help though-

-dave

> It is possible you have some corruption going on.
>
[quoted text clipped - 59 lines]
> > > >
> > > > Any suggestions or help will be greatly appreciated!
RainMan - 17 Oct 2007 21:42 GMT
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

> It is possible you have some corruption going on.
>
[quoted text clipped - 59 lines]
> > > >
> > > > Any suggestions or help will be greatly appreciated!
Stuart McCall - 17 Oct 2007 22:47 GMT
> 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
[quoted text clipped - 96 lines]
>> > > >
>> > > > 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.