Cutting and Pasting controls in VBA (1 Viewer)

Gav White

Registered User.
Local time
Today, 16:49
Joined
Jul 16, 2003
Messages
12
Hi all,

Does anyone if it is possible to cut a control (txtbox, combobox etc) from the detail section of a form, and then to paste it in either the header or footer section using just VBA code, and vice versa.

Any advice would be crackin'

Gav White
 

Gav White

Registered User.
Local time
Today, 16:49
Joined
Jul 16, 2003
Messages
12
Want to hide columns in datasheet view under certain conditions without using columnHidden property, because this does not properly hide it (can be reactivated by dragging the adjacent column).
Any other solution that anyone can provide about hiding a column like that without it being able to be found by the user would be ideal, as it is I'm clutching at straws for an answer at the moment.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:49
Joined
Feb 19, 2002
Messages
43,424
If you don't want users to access a particular column just remove it from the form's recordsource. If the form is bound directly to a table, create a query that shows only the columns you need and use that as the recordsource.
 

lilAndy

Registered User.
Local time
Today, 16:49
Joined
Nov 27, 2002
Messages
16
Hi Pat, thanx for the reply, but that's not quite what we meant.

Basically we have a form and subform. The subform is in datasheet view. We have 2 columns in the datasheet that we want to be hidden and inaccessible until a particular button is clicked on the main form.
It looks fine doing this with the columnHidden set to true or false depending on the clicked button, but since all columnHidden does is reduce the column's width to 0 it is possible for the users to resize the hidden column and make them completely viewable.
We need some way of making these two columns hidden most of the time, but we do need them at other points.
So far I've looked at using two separate subfoms (one containing the two fields, and one without them) and then switching from one to the other, and this does work, but I don't like the time-lag while the subform is switching and it just seems bit messy to me; it might however be the only way of doing what I want, in which case I'll have to play around with it more.
I did think about using the forms record-source to include or exclude the two columns that I wanted displayed, but for a form in datasheet view only the controls that are actually on the form are displayed in columns.

Any other thoughts on a possible solution to this problem?
 
Last edited:

Fizzio

Chief Torturer
Local time
Today, 16:49
Joined
Feb 21, 2002
Messages
1,885
Your two subform method is probably your best bet. How are you currently switching between the two?
 

lilAndy

Registered User.
Local time
Today, 16:49
Joined
Nov 27, 2002
Messages
16
I've implemented the two-subform in a test for now, but the three-second time lag while it's switching and updating still annoys me a little (perfectionist? me?)

I'm switching it in code using the subform's sourceObject.
 

Users who are viewing this thread

Top Bottom