selections based on a option button and a combo box.

G

Guest

Hi,
I have a option group and a combo box(drop down list) on my form and
depending on the user's selection of a option button, I'm doing some code in
the VBA. 'YearSelection' is my option group's name which has two radio
buttons to choose from and 'Counties_State' is my combo box name. The form's
name is Sample_Main. My code in VBA actually does the following:

If (Me!YearSelection.Value = 1) Then
If (Forms![Sample_Main]![Counties_State] = Null) Then
stDocName = "temp-DisName1"
Else
stDocName = "temp-DisName"
End If
End If

Here, even when the user selects some county from the 'Counties_State' combo
box which means Forms![Sample_Main]![Counties_State] holds the selected
county but, the Else part is not being executed. Is there anything wrong with
my conditions. Please help me in solving this problem.

thanks,
talktobatchu
 
V

Van T. Dinh

Use the IsNull() function instead.

If IsNull(Forms![Sample_Main]![Counties_State]) Then
....
 
G

Guest

Thanks Van, the solution you suggested worked good.

regards
talktobatchu

Van T. Dinh said:
Use the IsNull() function instead.

If IsNull(Forms![Sample_Main]![Counties_State]) Then
....

--
HTH
Van T. Dinh
MVP (Access)


talktobatchu said:
Hi,
I have a option group and a combo box(drop down list) on my form and
depending on the user's selection of a option button, I'm doing some code in
the VBA. 'YearSelection' is my option group's name which has two radio
buttons to choose from and 'Counties_State' is my combo box name. The form's
name is Sample_Main. My code in VBA actually does the following:

If (Me!YearSelection.Value = 1) Then
If (Forms![Sample_Main]![Counties_State] = Null) Then
stDocName = "temp-DisName1"
Else
stDocName = "temp-DisName"
End If
End If

Here, even when the user selects some county from the 'Counties_State' combo
box which means Forms![Sample_Main]![Counties_State] holds the selected
county but, the Else part is not being executed. Is there anything wrong with
my conditions. Please help me in solving this problem.

thanks,
talktobatchu
 

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

Top