Problem with Moving Cursor in Form/Subform

swbrodie

Registered User.
Local time
Today, 09:38
Joined
Apr 9, 2003
Messages
18
Hello.

I have a form, in datasheet view, that contains many records.

I first placed the following action on the load of the form

Go To Record = New

This put the cursor in a new record, which I wanted, but the new record is at the very bottom of the screen, which is not very pretty.

So I placed the following actions on the load of the form.

GoToRecord = New
SendKeys = {PGDN}{UP}{UP}{UP}{UP}{UP}{UP}
GoToRecord = New

This took the cursor to the bottom of the page, paged down, scrolled up six spaces, and then put the cursor in a new record. This way, only the last six records are displayed, and the content is toward the top of the screen, which looks a lot nicer. I know this is not very graceful, but it is the only thing I have found, so far, that does what I want it to do.

My problem is there is also a popup window that can be launched and will come up on top of the initial form (but not from it). This popup contains subforms, also in datasheet view, that I want to behave the same way. What happens is that when the popup comes up, it runs through the same code. The code not only affects the subforms, but the initial form as well, which causes the cursor in the initial form to move.

What is the best way to have this code apply only to the popup window? Apparently, the SendKeys command does not specify and is being confused.

If there is a better way to accomplish these things, I would LOVE to hear about it.

Thanks.
 
Checkout "Bookmarks." Set a bookmark to position the main form datasheet and another to position the popup datasheet.

You've on the right track of how to do it except you want to use bookmarks. Then you won't have any confusion between forms.
 
That sounds great!

I'm sure that I'm going to sound stupid, now, but I don't know how to set or read a Bookmark. I've tried reading the Help file, but it didn't tell me much about how to set one. I couldn't find an example there.

I guess I need to go to a New Record, make a Bookmark, then refer back to the Bookmark?

Can you point me in the direction of a couple of good examples? I'm not too good with VB. Okay, I'm less than not too good.

I have a feeling I'm going to spend all Memorial Day weekend working on this. ;)

Sorry to be a bother.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom