RE: value with check box
- From: "alexasha" <alexasha@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 5 Aug 2005 09:05:07 -0700
I am getting Run time error 438
Object doesn't support this property or method
Debuging highlights
Me!ROS_check = False
Can I do instead of this string the default value for checkbox to no
I tried other string for only two fields and getting the same error
Private Sub Check74_AfterUpdate()
Dim strDefaultValue(10) As String
If Me!ROS_check = True Then
strDefaultValue(0) = "NAD"
strDefaultValue(1) = "No problems"
Me!General = strDefaultValue(0)
Me!Nose = strDefaultValue(1)
End If
End Sub
Should I remove quotes (NAD, no problems)? ANy other mistakes that I have
done?
"Sprinks" wrote:
> Hi, Alexasha.
>
> OK. It seems you do in fact need 10 combo boxes, one each corresponding to
> each "system". Yes, if the value is text, use string variables instead,
> however, note that if you are using a combo box, they are normally set up to
> *display* text but *store* a numerical value in the underlying field. Check
> the combo box' BoundColumn property--this is the column that is stored.
> Since you have ten similar values, it's convenient to use an array.
>
> Dim strDefaultValue(10) As String
>
> If Me!YourCheckbox = True Then
>
> strDefaultValue(0) = YourValue0
> strDefaultValue(1) = YourValue1
> strDefaultValue(2) = YourValue2
> strDefaultValue(3) = YourValue2
> strDefaultValue(4) = YourValue2
> strDefaultValue(5) = YourValue2
> strDefaultValue(6) = YourValue2
> strDefaultValue(7) = YourValue2
> strDefaultValue(8) = YourValue2
> strDefaultValue(9) = YourValue2
>
> Me!YourFirstComboBox = strDefaultValue(0)
> Me!YourSecondComboBox = strDefaultValue(1)
> ....etc....
>
> End If
>
> If some are text and others numeric, use a variant array:
>
> Dim varDefaultValue(10) As Variant
>
> You may skip the array altogether, and just directly assign the values to
> your fields--it is just standard programming practice to define constants at
> the top of the code to make it easier to change later.
>
> Yes; place the code in the checkbox' AfterUpdate event procedure. The
> checkbox is presumably not bound to any field, so you'll want to uncheck it
> when you go to a new record. In the form's OnCurrent event procedure:
>
> Me!MyCheckbox = False
>
> Hope that helps.
> Sprinks
>
>
> "alexasha" wrote:
>
> > I guess I need to be more specific. I have medical record set up with review
> > of systems. I have system 1, system 2, etc. In my source table each systems
> > represented by separate column. The first row in source table contains normal
> > values for each system. Other rows contain abnormal values. So for one system
> > I might use normal value (row 1), for another abnormal value (row 2), and for
> > third value from 3d or 4th row in source table. In my report, I set up each
> > system on new line with label for that system. If there is no data entered in
> > the form field, which happens regularly, then both report field and label for
> > that field is blank. I do not see how I can change that, and it seems to work
> > fine.
> > Now, the expression
> > Dim intDefaultValue As Integer
> > intDefaultValue = YourValue
> > If Me!YourCheckbox = True Then
> > Me!YourComboBox = intDefaultValue
> > End If
> > seems that is might work. Should I place is in after update section? Another
> > question, my default value is a text, can I change first line to As Text?
> > Thanks for the help
> >
> >
> >
> > "Sprinks" wrote:
> >
> > > Alexasha,
> > >
> > > It is highly unlikely that you need 10 combo boxes if they are displaying
> > > different columns from the same record frpm the same source table.
> > >
> > > Normally, it is necessary to only store a numerical foreign key. For
> > > example, an Orders table would have a CustomerID field, but NOT a Customer
> > > Name, Address, Phone, etc. When interested in displaying these fields on a
> > > form or printing them on a report, the tables would be brought together in a
> > > query, linked by the common field.
> > >
> > > Another way to display these other fields is to include them as columns in a
> > > combo box, and use its Column property, setting a textbox' ControlSource to:
> > >
> > > =MyComboBox.Column(x), where x is the column index, beginning with zero.
> > >
> > > If in fact, the other nine form controls are meant to display other columns
> > > from the row specified by the combo box, it would only be necessary to set
> > > the combo box' value to a default--the others would simply display the
> > > corresponding column values once it is set:
> > >
> > > Dim intDefaultValue As Integer
> > > intDefaultValue = YourValue
> > > If Me!YourCheckbox = True Then
> > > Me!YourComboBox = intDefaultValue
> > > End If
> > >
> > > Replace YourValue with the default value, and YourCheckBox and YourComboBox
> > > with the names of your checkbox and combo box controls, respectively.
> > >
> > > Hope that helps.
> > > Sprinks
> > >
> > > "alexasha" wrote:
> > >
> > > > I have set up a form with 10 fields set up as combo boxes. I pull values for
> > > > those boxes from source table (10 columns, one for each field in the form). I
> > > > would like to be able to check one check box on the box so that default
> > > > values will appear in all 10 combo boxes. I guess it should be something like
> > > > this
> > > > if check box is 1 (checked) then field 1 = this value
> > > > if check box is 1 (checked) then field 2 = this1 value
> > > > I do not know how to write the correct expression. ALso, I do not want to
> > > > lose the ability to pull different values from source table, in case I do not
> > > > want default value.
> > > > I hope it is clear explanation.
> > > > Thanks
> > > >
.
- References:
- value with check box
- From: alexasha
- RE: value with check box
- From: Sprinks
- RE: value with check box
- From: alexasha
- RE: value with check box
- From: Sprinks
- value with check box
- Prev by Date: Using a subform to display and add info into table
- Next by Date: RE: value with check box
- Previous by thread: RE: value with check box
- Next by thread: RE: value with check box
- Index(es):
Relevant Pages
|