I am using Access 2010. This question is about a continuous form. The underlying table accepts movement of inventory from source to destination.
When the user opens the form, he/she will use an unbound combobox to choose whether the data entry will reflect items sold or items transferred. If the user chooses "transfer", then there is no need to enter information in some fields... ie [price], [discount] etc.
In such cases (user has chosen "transfer"), I would like the unwanted fields to disappear. That is easy enough. I also want to collapse the empty space so that the resultant form does not look like a patchwork quilt. It would be great if I could put these fields on the outermost right of the form, but this is not possible. I would like to emulate the way that Excel does it when you hide a column.
At this time, the best that I can come up with is to make them invisible, set their width to one pixel and move all the other columns next to the invisible column. I haven't tried this yet. It seems like a complex way to solve a simple problem.
I really would like to perform both tasks in one form. Is there a better way?
Microsoft Access
Last Comment
Jeffrey Coachman
8/22/2022 - Mon
Scott McDaniel (EE MVE )
Is your continuous form in Datasheet view? If so, you can use the ColumnHidden method:
Me.Text0.ColumnHidden = True
peispud
ASKER
Nope.. Form is not in Datasheet view.
I have set the view to continuous form.
Dale Fye
Since you are in a continuous form, the problem will be that some records may say "Transfer" and others may reflect another value, so depending on what record you are on, you may want to suppress certain values while displaying those same values in the other records.
It is not possible to hide values in one record, but not in another in a continuous form. It is one or all.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
peispud
ASKER
There will be no confusion in the record
Each record will have a field which will say "Transfer" or "Sale".
If the current record represents a transfer, then fields like [Price} and [Discount} do not apply.
The user will be entering this information in batches (~200).
I'm starting to think that the only way is to create two forms.
Dale Fye
Have you tried the method described above:
1. Open the form in design mode
2. Select the [Price] and [Discount] controls
3. Click the Conditional Formatting button on the ribbon or menu option (depending on version).
4. Set the Condition1 combo box to "Expression Is", then set the expression like:
[FieldName] = "Transfer"
5. Then change the foreground and background colors so that they are the same as the detail section background color (or as close as you can get).
6. Click OK
7. Then select the [Price] control, select the "GotFocus" event from the Properties -> Event tab, and select [Event Procedure], and then go to that event in the VBA window.
8. In the GotFocus event, add some code to change the focus from that control to another control, one that can change.
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman
Thanks,
As fyed will also tell you, we are big proponents of not only trying to let you see the many ways of doing something, but to also suggest alternatives.
Me.Text0.ColumnHidden = True