Ok, form.refresh IS resetting the currently selected item

G

Guest

I got into a thread a few days ago on this, but couldn't see the problem. Now
it's back.

I have a table that is displayed in a continuous form. When the user
double-clicks, a details form pops up for editing the currently selected row.
When they close, the editor form calls "refreshFromPopup" on it's parent.
Here is refreshFromPopup...

Public Sub refreshFromPopup()
Me.Refresh
End Sub

When called, the "selected row" is reset to the top of the form, ie, zero.
Commenting out that single line makes the problem go away, but also means you
don't see any edits made in the popup (obviously).

Anyone have any ideas?

Maury
 
D

Douglas J. Steele

Keep track of what record you're on before you refresh, and go back to it
afterwards. Take a look at the Bookmark property in the Help file.
 
D

Dirk Goldgar

Maury Markowitz said:
I got into a thread a few days ago on this, but couldn't see the
problem. Now it's back.

I have a table that is displayed in a continuous form. When the user
double-clicks, a details form pops up for editing the currently
selected row. When they close, the editor form calls
"refreshFromPopup" on it's parent. Here is refreshFromPopup...

Public Sub refreshFromPopup()
Me.Refresh
End Sub

When called, the "selected row" is reset to the top of the form, ie,
zero. Commenting out that single line makes the problem go away, but
also means you don't see any edits made in the popup (obviously).

Anyone have any ideas?

When you refer to the "selected row", are you talking about a record
that is actually *selected*, or are you just talking about the record
that is current? Oddly, Form.Refresh doesn't change either one, the
selection or the current record, for me in my tests. Are you doing this
in an .mdb file, like me, or are you running in an .adp?

Doug Steele has posted a workaround, but I wouldn't expect such a
workaround to be necessary.
 
G

Guest

Douglas J. Steele said:
Keep track of what record you're on before you refresh, and go back to it
afterwards. Take a look at the Bookmark property in the Help file.

That's what I was doing, but this fails on a wide variety of machines and
Access versions. It even fails on any particular machine under certain
circumstances that appear to have no pattern.

Maury
 
G

Guest

Dirk Goldgar said:
When you refer to the "selected row", are you talking about a record
that is actually *selected*, or are you just talking about the record
that is current?

I do not understand the difference between these two terms. The line in
question is the one with the triangle pointing to it in the record selector.
Oddly, Form.Refresh doesn't change either one, the
selection or the current record, for me in my tests. Are you doing this
in an .mdb file, like me, or are you running in an .adp?
..adp.

Doug Steele has posted a workaround, but I wouldn't expect such a
workaround to be necessary.

It was the failure of the bookmarking method that led me to post here.

Maury
 
D

Dirk Goldgar

Maury Markowitz said:
I do not understand the difference between these two terms. The line
in question is the one with the triangle pointing to it in the record
selector.

That would be the row that is "current". If the record selector is
highlighted, that row is also "selected". It is possible for a row on a
continuous form to be selected but not current.
It was the failure of the bookmarking method that led me to post here.

This may be some ADP phenomenon, which I've never seen because I've
never done more with ADPs than experiment very briefly. I have never
seen an MDB behave as you describe, so I can't tell if there's something
about ADPs that is different, or if something odd is going on in your
database. I have no good way to test this, I'm afraid. Maybe somebody
else who does use ADPs can offer some advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top