Auto fill

R

Radhika

I have two fields from the same table:
1. No side effect (Check box:yes/no)
2. Side Effect Description (drop down box)

I want 'Side Effect Description' to default to 'N/A' if 'No side effect is
checked'. Below is the code I am using in the got focus event:
Private Sub Tumor_Description_GotFocus()
If Me.[No Side effect] = True Then
Me.[Side Effect Description]='N/A'
End If

End Sub

However, I get an error message when I use this code. What am I doing wrong?

Thanks,
Radhika
 
M

Maurice

What is the error message you are getting?
What is the recordsource for the combobox, a valuelist with two options? The
'N/A' option should be one of the options you can choose from in the combo.
If it is try adding double quotes around the instead of single qoutes like
"N/A".
 
R

Radhika

The Error message says:
Invalid procedure call or arguement.

The combobox is from a value list with three options, one of which is N/A. I
tried putting N/A in double quotes, however, i still get the error message.

Is there something else that could be wrong?

Is it correct is use '=True' for a check box?

Thank you,
Radhika

Maurice said:
What is the error message you are getting?
What is the recordsource for the combobox, a valuelist with two options? The
'N/A' option should be one of the options you can choose from in the combo.
If it is try adding double quotes around the instead of single qoutes like
"N/A".
--
Maurice Ausum


Radhika said:
I have two fields from the same table:
1. No side effect (Check box:yes/no)
2. Side Effect Description (drop down box)

I want 'Side Effect Description' to default to 'N/A' if 'No side effect is
checked'. Below is the code I am using in the got focus event:
Private Sub Tumor_Description_GotFocus()
If Me.[No Side effect] = True Then
Me.[Side Effect Description]='N/A'
End If

End Sub

However, I get an error message when I use this code. What am I doing wrong?

Thanks,
Radhika
 
M

Maurice

That's strange. I tried what you have and got it to work. See if I did this
correctly;

1. checkbox datatype yes/no
2. combobox ; valuelist with three options : option1,N/A,option3
3. textbox1

in the code editor I placed the following line of code;

private sub textbox1_gotFocus
if me.checkbox then '- you can ommit the = true
me.combobox="N/A"
end if

This works for me. Are you sure the fieldname is correctly spelled and that
the combobox is set to valuelist and not list of fields?

end sub


--
Maurice Ausum


Radhika said:
The Error message says:
Invalid procedure call or arguement.

The combobox is from a value list with three options, one of which is N/A. I
tried putting N/A in double quotes, however, i still get the error message.

Is there something else that could be wrong?

Is it correct is use '=True' for a check box?

Thank you,
Radhika

Maurice said:
What is the error message you are getting?
What is the recordsource for the combobox, a valuelist with two options? The
'N/A' option should be one of the options you can choose from in the combo.
If it is try adding double quotes around the instead of single qoutes like
"N/A".
--
Maurice Ausum


Radhika said:
I have two fields from the same table:
1. No side effect (Check box:yes/no)
2. Side Effect Description (drop down box)

I want 'Side Effect Description' to default to 'N/A' if 'No side effect is
checked'. Below is the code I am using in the got focus event:
Private Sub Tumor_Description_GotFocus()
If Me.[No Side effect] = True Then
Me.[Side Effect Description]='N/A'
End If

End Sub

However, I get an error message when I use this code. What am I doing wrong?

Thanks,
Radhika
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top