selections based on a option button and a combo box.

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Use the IsNull() function instead.

If IsNull(Forms![Sample_Main]![Counties_State]) Then
....
 
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
 
Back
Top