Command Button Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have added some command buttons to a form using the wizard to create the
Sub shown below. The buttons worked the first couple of times I checked them
and then suddenly I started getting this error message:
"A problem occurred while Microsoft Access was communicating with OLE server
or ActiveX control"

This is the same code that I have been using FOREVER to handle these events
so I'm very confused as to what is wrong. Can anyone tell me what the problem
might be?
================================
Private Sub btn_QRpt_Click()
On Error GoTo Err_btn_QRpt_Click

Dim stDocName As String

stDocName = "Quality Review"
DoCmd.OpenReport stDocName, acPreview

Exit_btn_QRpt_Click:
Exit Sub

Err_btn_QRpt_Click:
MsgBox Err.Description
Resume Exit_btn_QRpt_Click

End Sub
 
hi,
i don't think this code is your problem. your message
stated that you have a communication problem. that's is
usually network related.
where is report Quality Review getting is data?
 
It is in the database on our shared drive on the server. The reason I
thought it might be a code problem is because I can launch them manually and
also if I create a button that uses an Open Form macro instead of the code
then it works just fine!
 
Back
Top