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!

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?

Ahhh, thanks a lot!
It's working now!

you can use in following ways

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.