Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Access VBA Opening Form to display specific record without filter

Posted on 2004-09-08
4
1,329 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

792 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