Using the result of a Pull Down as a Switch

  • Thread starter Thread starter Bunky
  • Start date Start date
B

Bunky

I have a form that has an Action_Taken pull down powered by a query called
disciplinesteps. Also on this form, I have an area named points. The points
area has a default of 1.00. What I want to happen, is when the operator
selects an Action_Taken with the characters like "*FMLA*", it will
automatically change the point value to 0.00. I have got it to work when I
am checking the comments box that is entered but the pull down will not fire.
Ideas.

Here is the code.
Private Sub Comments_AfterUpdate()
If Me.Comments.Value Like "*FMLA*" Then
Me.Points.Value = "0.00"
End If

If Me.Action_Taken.Value Like "*FMLA*" Then
Me.Points.Value = "0.00"
End If

End Sub

First if works fine but the second will not. Why? (I am very new to VB.)

Thank you for your assistance.
 
If the column in the row source of your combo box (pull down) that
stores the FMLA value is not the bound column, then you need to
reference it using the Column method like;

If Me.Action_Taken.Column(x) Like "*FMLA*" Then
Me.Points.Value = "0.00"
End If

Where x is the numeric value of the appropriate column in the row
source query. It's a zero based index, so the first column is Column(0),
second is Column(1), etc.

BTW - .Value is the default property of text boxes etc., so you don't
have to explicitly reference it. You can just do;
Me!Points = "0.00"
 
Beetle - I am sorry, the row source is a table - not a query. I went ahead
and tried your solution and it did not work. I tried both (0) and (1) even
though it is bound.

Ideas?
 
Open the properties sheet for your combo box and look at the
following properties;

Bound Column (on the Data tab)
Column Count (on the Format tab)
Column Widths (on the Format Tab)

and post back.

Also, how many fields are in the table that is being used as the
row source and which field holds the FMLA value.
 
Bound Column - 1
Column Count - 1
Column Width - Blank

# of fields in table = 2 and only 1 as the row source (Discipline Steps).
It is defined as a text field with 50 bytes in length. In the table, there
are two rows that reference to "FMLA".
 
If that's the case, then the code you listed in your first post *should*
work (I even create a small test app and it works fine on my end).
Unfortunately, I'm a little baffled as to why it's not working for you.

Sorry I couldn't be of more help.
 
Back
Top