Object Doesnt support this property....

CEH

Curtis
Local time
Today, 06:22
Joined
Oct 22, 2004
Messages
1,187
This error appears when a preview or print button is used. The form has been opened with this.....

DoCmd.OpenForm stDocName, , , , acFormAdd, acWindowNormal

But when I try to preview it gets the error.......
"Object doesnt support this property........."

Same error occurs when the form is opened with.....
DoCmd.OpenForm stDocName, , , , acFormReadOnly, acWindowNormal, stLinkCriteria

The preview button is this.........

Private Sub cmdPreviewRptWO_Click()
On Error GoTo Err_cmdPreviewRptWO_Click

Dim stDocName As String
stDocName = "rptWorkOrderCurrent"

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport stDocName, acPreview

Exit_cmdPreviewRptWO_Click:
Exit Sub


The really strange thing is I have 2 forms both coding the same..... One doesnt give the error!!

I think the error occurs when it is trying to save before previewing...But it has to save to view the report.

Anyone have the answer?? :confused:
 
First off, make sure that the saving is causing the problem.

Try adding a ' in front of
Code:
DoCmd.RunCommand acCmdSaveRecord

If the error doesn't occur anymore, try replacing
Code:
DoCmd.RunCommand acCmdSaveRecord
with
Code:
Me.Refresh

Greetz,

Seth
 
How can you save a record on a form that's ReadOnly?
 
Works...but second problem created

OK, that makes sense... and works. Replaced the cmdSave with Me.Refresh. But creates another problem. I figured out why one of my forms worked, one didnt. The one that worked had some coding on different text boxes forcing entries......... It DID work fine....

Private Sub Form_BeforeUpdate(Cancel As Integer)

If IsNull(WODate) Or WODate = "" Then
MsgBox "Required Field", vbCritical + vbOKOnly + vbDefaultButton1, "Missing Data"
WODate.SetFocus
Cancel = True
Exit Sub

But now............... When you preview,and data is missing, gives the pop up error box, but then continues and show a blank report..........
 
OK......................info needed

So how do I cancel the print and preview commands if these fields are empty?
 
You can do this by performing this check just before you open your report.

Code:
If IsNull(WODate) Or WODate = "" Then
   MsgBox "Required Field", vbCritical + vbOKOnly + vbDefaultButton1, "Missing Data"
   WODate.SetFocus
Else
   DoCmd.OpenReport ...
 
Thanks Seth

Thanks,
Seems to working fine now. Appreciate your help.
 

Users who are viewing this thread

Back
Top Bottom