Sinister Beard
Sinister Beard

Reputation: 3680

Is it possible to run VBA code only affecting one row in a continuous form?

I have a continuous form that display the results of a query. I'd like to include a button on each line of the form that expands that line of the form to show some supplamentary data. I want to do this without moving to another form, though using a subform would be fine - this is as a user request.

Is this sort of thing possible?

Upvotes: 2

Views: 1409

Answers (2)

Andy G
Andy G

Reputation: 19367

As mentioned in my comment, I don't believe your specific request is possible. That is, to dynamically change the height of the detail section of a continuous form, but only for the current row (this is my understanding of your request).

You could have some unbound controls in the form footer that are populated with values for the current record when the button is clicked. These values could be copied from a number of hidden controls in the detail section. (These hidden controls can sit above the visible controls, so that the detail section needn't be increased to accommodate them.)

However, you would probably want some additional code to clear these values. But on what event (or events) would you run this code? One event that occurs to me is the Timer event of the Form, so that the controls would be cleared (or possibly hidden) after a short interval. You could use the Current event, so that when they move to another row the details are cleared, but if they just scroll the form then the details will remain displayed, which may be confusing for the user.

Of course, the simpler solution is just to use a subform, or another form - perhaps modal/popup.

Upvotes: 2

basdwarf
basdwarf

Reputation: 422

yes, use the On_Current Event to know which row you are working with.

Upvotes: 0

Related Questions