Full Version: How To Navigate To Specified Record On Form_open
UtterAccess Forums > Microsoft® Access > Access Forms
Javiator
Hello,

I am designing a form where, when the form is opened, I would like it to navigate to the first record (according to the sort order in the form's record source query) where the [Answer] field is null. What VBA code would be required to accomplish this?

Thanks!
theDBguy
Hi. Are you saying just go to the first null record?
Javiator
No. In this case, there won't be any null records, but records with nulls in the [Answer] field need the user's input. Otherwise, they would have to cycle through everything to find these. They need to have access to all of the records, otherwise I would just add a condition to the WHERE clause of the record source query. I was thinking of just setting the form to open directly to the first record requiring input. As an alternative, I suppose I could drop a "hide answered questions" checkbox on the form and code it to toggle the WHERE clause and requery the form. Thoughts?
Javiator
By the way, congrats on passing 60K!
theDBguy
>>By the way, congrats on passing 60K!<<
Thanks!

If the user needs to handle all the records with empty Answers field at the same time, it might be simpler to provide a button to filter the form rather than have the form go to the first record but not have another way to go to the next one, especially if it's far away in the sort order. There was a demo I posted not too long ago that does this. Let me see if I can find a link for you.

Edit: Found it, but I guess it was just a code snippet and not a demo. Here's the link. Hope that helps...
Javiator
Thanks! notworthy.gif
theDBguy
You're welcome! Good luck!
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.