run-time error 2136

K

Kim

I am new at access programming and slowly learnign my way - but I built an
application for a friend to run reports on some class/students related data
I sent her the db - and now she is having this error.
But when I run the app - i am not gettign the error...
Any ideas>? Thanks in Advance, Kim

I have a form with a combo box of class id's - I need to select the class in
the combo and then click on one of the buttons to run a report.

When I click this buitton I get the error: "run-time error 2136 - to set
this property , open the form or report in design view."

Here is the code behind it.




Private Sub cmdClassList_Click()
On Error GoTo Err_ClassListButton_Click

Dim stDocName As String

If IsNumeric(cmbClassDatesAll.Value) = True Then
' check if there are any participants for this class
If IsNull(DLookup("[orderDetailID]", "orderDetail", "[classdatesID] = "
& cmbClassDatesAll.Value)) Then
MsgBox ("There are no Participants Registered for this Class")
Else
stDocName = "classDates"
DoCmd.OpenReport stDocName, acPreview, , "classDates.classDatesID =
" & cmbClassDatesAll.Value
End If
Else
cmbClassDatesAll.SetFocus
MsgBox ("A class selection is required")
End If

Exit_ClassListButton_Click:
Exit Sub

Err_ClassListButton_Click:
MsgBox Err.Description
Resume Exit_ClassListButton_Click

End Sub
 
W

Warrio

The code below doesn't show any property that could make such an error

the error means that your code is trying to set a property that can't be set
in a screen mode but only in a design view.

in your code, nowhere you're doing such a modification..



Try to see if your report "classDates" has any code that can make the
error..

if not, you have to see at which line the error is happening, for that use a
breakpoint (Menu Debug, Toggle Breakpoint Or F9) on the top the beginning of
your procedure and use the key F8 to execute the code line by, when the
error will happen, it yellow line will move directly to
Err_ClassListButton_Click: part.
 

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