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

VBA Function Assistance

100+
P: 166
Hello,

I have a continuous for which allows my users to select from cascadinig combo material types and the cooresponding materials they would like to use to create a mix. when the user selects they pigment material, they have to input the pigment percent they are using...this is only true when they are using a pigment. My idea was to have in the form's on current event an IIF statement that said If material type is a pigment(cbo_matTypeId=4), make the text box visible, like so:

Private Sub Form_Current()

'If material type is a pigment(cbo_matTypeId=4), make the text box visible
If Me.cbo_matTypeID = 4 Then
Me.txtPigPercent.Visible = True
Else
Me.txtPigPercent.Visible = False
End If

End Sub

The issue I am seeing is that because the form is continuous, when the pigment is selected, it shows up for every record, not just the pigments. I tried to put it in the footer but the problem with that method is that if the user uses more than one pigment for a mix, the control being in the footer only represents the pigment percent for one pigment, not the possible many that may be used. How can I make the text box work, if the user has more than one pigment to input?
Dec 3 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,287
You can't set things for continuous forms in code (easily), but you can do formatting conditions and it will apply separately to each record.
Now, textbox.visible is not something you can control with a formatting condition, but textbox.enabled is.
So in design mode you set the txtpigpercent to disabled, in Conditional Formatting set to Expression Is (I'm not sure whether this was available before Access 2007) cbo_matTypeID = 4, and I don't know what that Icon is supposed to be but it's Enabled and it's next to the font color.
Dec 3 '08 #2

100+
P: 166
Hi Chip,

Once again, it worked perfectly. Thank you.

(I'm from Bowie, Maryland! Must be the MD Smarts!)
Dec 3 '08 #3

Post your reply

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