0

Ok so I'm a casual VB6 programmer and now I'm VBA for Access. In VBA I am trying to determine if whether an option button has been pressed. I used the 'Option1.Value' procedure yet it throws a 'You entered and expression that has no value' error.

Here's my code:

Dim stDocName As String
If optEligibility.Value = 1 Then
    stDocName = "rptEligibiltyRoster"
Else
    stDocName = "rptTypicalRoster"
End If
DoCmd.OpenReport stDocName, acPreview

Thanks!

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by dwel
0

Your problrm lies in the data values. If there is no records available, but you are still calling it, there will be errors generated.

first trap the erroes and then call the recordset. In other words, if there are no records to show, exit the sub and then call something else.

does this make sense?

0

you can use in following ways

If option1.Value =true Then
...........
Else
...........
End If

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.