By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,572 Members | 2,949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,572 IT Pros & Developers. It's quick & easy.

Is there a way to set the CanShrink property in VBA or code view?

P: 1
Hello,

I'm trying to utilize the CanShrink property of the textbox so that any null value don't show up in the report. I have 6 columns textboxs that can be display up to 30 rows. If the first column of the textboxes in a row in the report has a null value, I'd like to set the rest of the 5 columns' CanShrink property in the same row to be Yes(or True) while the default CanShirnk is set to No.

After some research, it seems like CanShrink property setting cannot be achieveved in VB or macro since it's ReadOnly mode in VB and macro. My question is that is there a way or workaround to have CanShrink property set in VB?

Thanks,
Scott
Feb 3 '08 #1
Share this Question
Share on Google+
2 Replies


puppydogbuddy
Expert 100+
P: 1,923
Hello,

I'm trying to utilize the CanShrink property of the textbox so that any null value don't show up in the report. I have 6 columns textboxs that can be display up to 30 rows. If the first column of the textboxes in a row in the report has a null value, I'd like to set the rest of the 5 columns' CanShrink property in the same row to be Yes(or True) while the default CanShirnk is set to No.

After some research, it seems like CanShrink property setting cannot be achieveved in VB or macro since it's ReadOnly mode in VB and macro. My question is that is there a way or workaround to have CanShrink property set in VB?

Thanks,
Scott
Scott,
You can try:
YourTextbox.CanShrink or
YourReportSection.CanShrink

If that does not work, you can use the MoveSize command to resize and shift controls in code.
Feb 3 '08 #2

P: 1
I've tried that and it doesn't work. Access just doesn't allow to change the setting of CanShrink property in VBA or macro. Also, the textbox doesn't have MoveSize property. What I've ended up doing in order to achieve my goal is that I had to write a macro for each textbox ( that's 30 rows x 5 columns = 150 textboxes ) using IIF function as below.

=IIf(Not IsNull(Field1) and IsNull(Field2), " ", Field2) ' for column2 in the report
=IIf(Not IsNull(Field1) and IsNull(Field3), " ", Field3) ' for column3 in the report
and so on.

It was very time consuming and tedious, but it seems this is the only solution I can come up with for now.

Thanks,
Scott
Feb 4 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.