Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access VBA Opening Form to display specific record without filter

Posted on 2004-09-08
4
Medium Priority
?
1,345 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
[X]
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
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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

610 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