Opening form without filtering records

hrufescens
hrufescens used Ask the Experts™
on
Hi,

I have a form with a subform that feeds off the same table.  I'd like the user to be able to click a button in the subform and have the main form jump to that record.

When I try this using the wizard, the main form jumps to the desired record just fine, but it is filtered.  Is there a way to code this so my users don't end up in a one-way street?  Put another way, is there a way to leave the main form at the desired record and still have the navigation buttons work properly?

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
alter your codes to use FindFirst instead of filtering the form


post the codes that you are using

Author

Commented:
Hi capricorn1,

Code I'm using is the standard wizard output.

I get your comment- can you hold my hand on syntax?  Something like

recordset.FindFirst  <blahblahblah>

where blahblahblah matches two fields:  ID_Room on the parent form and ID_Room on the subform.

Thanks
Top Expert 2016

Commented:

     with me.parent.recordsetclone
            .findfirst ="[ID_Room]= " & me.[ID_Room]
            if not .nomatch then me.parent.bookmark=.bookmark


     end with
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Had a problem:
Run-time error '3251' Operation is not supported for this type of object

on this statement:
.FindFirst = "[ID_Room]= " & Me.[ID_Room]
Top Expert 2016

Commented:
post the whole code.
where are you calling the codes from?

you can not identify where the problem is, by just posting a part of the codes

Author

Commented:
Calling this code on double-click [event procedure].
Option Compare Database
 
Private Sub Elev_DblClick(Cancel As Integer)
    With Me.Parent.RecordsetClone
        .FindFirst = "[ID_Room]= " & Me.[ID_Room]
        If Not .NoMatch Then Me.Parent.Bookmark = .Bookmark
    End With
End Sub

Open in new window

Top Expert 2016

Commented:
can you attach your db. check attach file below

Author

Commented:
Sure- I'll have to un-split it and shrink it a bit.  Hold on..

Author

Commented:
Here it is, boiled down to the tables/forms in question. Thanks...
GapDB-excerpt.mdb
Top Expert 2016
Commented:
my bad... my mistake

use this

Private Sub Elev_DblClick(Cancel As Integer)
    With Me.Parent.RecordsetClone
        .FindFirst  "[ID_Room]= " & Me.[ID_Room]
        If Not .NoMatch Then Me.Parent.Bookmark = .Bookmark
    End With
End Sub

Author

Commented:
Thank you capricorn1- works great.  You're awesome!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial