Different widths of one field in multiple records

ErinL

Registered User.
Local time
Today, 17:20
Joined
May 20, 2011
Messages
118
Hello everyone -

Is it possible to vary the width of a field between records?

I have a form with fields "Batch", "TotalUnits", "Units Done", "UnitsRemaining" and "PercentageDone". I would like to somehow create a sixth field "PercentageBar" whose width is based on the data in the "PercentageDone" field.

In my trials to get this done, I have been able to set the width and have it change but the width is determined by the information in the first record only. It does not vary the width for each record.

Maybe this isn't possible. If anyone has any suggestions, I would greatly appreciate it.

Thank you in advance.
 
What event are you using to fire the code?

I think it should work if fired from the Forms's OnCurrent and the form's AfterUpdate events.
 
If the Form is in Continuous View or Datasheet View, the answer is 'No,' you cannot do it.

If the Form is in Single View, i.e. only shows one Record at a time, you should be able to do it. If this is the case, you probably have your code in the wrong event. It would need to be in the Form_Current event rather than in the Form_Load or Form_Open events.

Linq ;0)>
 
Hi and thank you for the very quick response.

I have tried it under every event that I thought would work and none of them made the field width different for each record.

Currently I have the following in the OnCurrent event:

Private Sub Form_Current()
Me.PercentageBar.Width = ([PercentageDone] / 100) * (1440 * 3)
End Sub
This does adjust the width based on the PercentageDone field but sets the width for every record to the width based on the first record's information. I would like it to be different for every record.
 
Thank you, Linq.

Sounds like that is my problem. I have to have the form set to continuous so that each batch shows on the screen at the same time (it will be projected for the order selectors to see so they are aware of the workload and progress of the batch throughout the day).

Would you happen to have any suggestions on how else I could do this? I have tried different avenues for doing this including progress bars, rectangle shapes, etc. At this point, I am at a loss.

Thanks again for the info. It was really driving me crazy so an explanation as to why this isn't working is a mental relief. :op
 
... sets the width for every record to the width based on the first record's information. I would like it to be different for every record.
Actually I suspect if you moved to the second record it would set the width for every record to the width based on the second record's information, and so forth. Doing physical appearance formatting, on Continuous and Datasheet View Forms, that is Record-appropriate, can only be done thru the Tools - Conditional Formatting, and formatting the dimensions of a Control is not offered by this tool. I know of no way, on this type of form, for doing this. Sorry!

Linq ;0)>
 
I believe this was discussed in your other thread ErinL -->

http://www.access-programmers.co.uk/forums/showthread.php?t=216597

You were advised to use the String() function in the Control Source of a textbox as a workaround.

E.g.
Code:
=String([Percentage Done] / 2, "|")
It can actually look very nice if done properly. For exampke you could set the ForeColor of the textbox to blue, then set the BackColor to grey and lock the textbox (i.e. Enabled = No, Locked = Yes), then perhaps Bolden the text too and slightly increase the font size.
 
I didn't receive any notices that anyone replied to my last post so I didn't know those other replies were out there. Now that I went back and looked there were quite a few more.

I didn't think that the String() was going to work because I need to show even a 1% increase but then I figured out that if removed the "/2" from the calculation it worked like I needed it to and, you're right, it doesn't look too bad! :)

Thank you for all your help and I am going to go back and reply to vbaInet too...now that I understand what he was trying to tell me. ;)
 
I didn't receive any notices that anyone replied to my last post so I didn't know those other replies were out there. Now that I went back and looked there were quite a few more.
Perhaps you turned it off in error or it just failed to send you a notification.

I didn't think that the String() was going to work because I need to show even a 1% increase but then I figured out that if removed the "/2" from the calculation it worked like I needed it to and, you're right, it doesn't look too bad! :)
It's always good to give it a try before dismissing the idea ;) And yes it doesn't look too bad at all :)

Thank you for all your help and I am going to go back and reply to vbaInet too...now that I understand what he was trying to tell me. ;)
He's here anyway so he's glad to hear that it works for you! :)
 

Users who are viewing this thread

Back
Top Bottom