Solved

Access VBA Opening Form to display specific record without filter

Posted on 2004-09-08
4
1,322 Views
Last Modified: 2007-12-19
I need to get a form to open another form and display a specific record. BUT I don't want to apply a filter because the user needs to select any record if they don't want the specific one that is displayed.

I have tried opening the form with a LinkCriteria that selects the records I want (and that works), but if I then remove the filter (forms!formname.filteron=false) the filter is removed but the form jumps to the first record in the database.

The form has an 'OrderBy' on it and I can't take that off because the form sequence would then make no sense to the user.

This is one of those 'this should be simple but I am damned if I can find the answer" questions.
0
Comment
Question by:dr_dudd
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 12005097
Hello dr_dudd,

Not clear what the real problem is here.

If the user doesn't want the initially displayed record and removes the filter why does it matter which record is then displayed as a result of that action?  Presumably, the user will go on to find the record they actually want using the built-in tools or developer-provided search facility?
And I understand you're saying that you don't want the natural results to occur but you don't say what you DO want to happen.


Pete
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12005189
If you put this code in the event that the user selects not to use the current record it should remove the filter and then return the user to the same record:

    Dim myBookmark As Variant

    myBookmark = Bookmark
    Me.FilterOn = False
    Bookmark = myBookmark
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 125 total points
ID: 12005853
I'd generally open the form and find the record that you're interested in. This also uses bookmarks:

DoCmd.OpenForm "MyForm"
Forms!MyForm.RecordsetClone.FindFirst "[ID]=111"
Forms!MyForm.Bookmark=Forms!MyForm.RecordsetClone.Bookmark
0
 
LVL 2

Author Comment

by:dr_dudd
ID: 12007147
Thanks Shane spot on! I thought about bookmarking as Sam's idea but the issue was that it was not this form I wanted to bookmark, but the one that I opened. Creating a recordset clone and then using its boomark - genius!

Thanks for all replies.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now