command button error

G

GitarJake

Hello All,

I keep getting the following error when I try to open a pop-up form from a
sub-form:

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while the Database was communicating
with the OLE server or ActiveX Control..

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Here is the On Click VBA:

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

The references are as follows:

Visual Basic for Applications
MS Access 9.0 Object Library
OLE Automation
MS Calendar Control 9.0
MS ActiveX Data Objects 2.1 Library

I know I've done this before. Exactly the same way. Why doesn't this
work?

TIA,

Jake
 
G

GitarJake

Hi Ken,

No, there's only one. Posted below:

Option Compare Database
Option Explicit

Private Sub Combo46_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[EmployeeID] = " & Str(Me![Combo46])
Me.Bookmark = rs.Bookmark
End Sub

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

Hope you can help.

Thanks,

Jake


Ken Snell said:
Any chance you have two procedures named Command48_Click in your form's
module?


--
Ken Snell
<MS ACCESS MVP>

GitarJake said:
Hello All,

I keep getting the following error when I try to open a pop-up form from a
sub-form:

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while the Database was communicating
with the OLE server or ActiveX Control..

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Here is the On Click VBA:

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

The references are as follows:

Visual Basic for Applications
MS Access 9.0 Object Library
OLE Automation
MS Calendar Control 9.0
MS ActiveX Data Objects 2.1 Library

I know I've done this before. Exactly the same way. Why doesn't this
work?

TIA,

Jake
 
K

Ken Snell

When you open the form in design view and open the Properties window, do you
see [Event Procedure] in the window next to On Click for the command button?
If you click the "three-dots" box at far right, does it go to the desired
procedure?

--
Ken Snell
<MS ACCESS MVP>

GitarJake said:
Hi Ken,

No, there's only one. Posted below:

Option Compare Database
Option Explicit

Private Sub Combo46_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[EmployeeID] = " & Str(Me![Combo46])
Me.Bookmark = rs.Bookmark
End Sub

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

Hope you can help.

Thanks,

Jake


Ken Snell said:
Any chance you have two procedures named Command48_Click in your form's
module?
from
a
sub-form:

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while the Database was communicating
with the OLE server or ActiveX Control..

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Here is the On Click VBA:

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

The references are as follows:

Visual Basic for Applications
MS Access 9.0 Object Library
OLE Automation
MS Calendar Control 9.0
MS ActiveX Data Objects 2.1 Library

I know I've done this before. Exactly the same way. Why doesn't this
work?

TIA,

Jake
 
G

GitarJake

Yes, there is an Event Procedure next to On Click and I do go to the correct
Sub when I click the ellipse.

Jake


Ken Snell said:
When you open the form in design view and open the Properties window, do you
see [Event Procedure] in the window next to On Click for the command button?
If you click the "three-dots" box at far right, does it go to the desired
procedure?

--
Ken Snell
<MS ACCESS MVP>

GitarJake said:
Hi Ken,

No, there's only one. Posted below:

Option Compare Database
Option Explicit

Private Sub Combo46_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[EmployeeID] = " & Str(Me![Combo46])
Me.Bookmark = rs.Bookmark
End Sub

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

Hope you can help.

Thanks,

Jake


Ken Snell said:
Any chance you have two procedures named Command48_Click in your form's
module?


--
Ken Snell
<MS ACCESS MVP>

Hello All,

I keep getting the following error when I try to open a pop-up form
from
a
sub-form:

The expression On Click you entered as the event property setting produced
the following error: A problem occurred while the Database was
communicating
with the OLE server or ActiveX Control..

*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro.

Here is the On Click VBA:

Private Sub Command48_Click()
On Error GoTo Err_Command48_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmNotes"

stLinkCriteria = "[RecordID]=" & Me![RecordID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command48_Click:
Exit Sub

Err_Command48_Click:
MsgBox Err.Description
Resume Exit_Command48_Click

End Sub

The references are as follows:

Visual Basic for Applications
MS Access 9.0 Object Library
OLE Automation
MS Calendar Control 9.0
MS ActiveX Data Objects 2.1 Library

I know I've done this before. Exactly the same way. Why doesn't this
work?

TIA,

Jake
 
K

Ken Snell

Nothing obvious jumps at me re: why this error would occur. Are all the
references ok in the References list (via VBE)? Or perhaps the DB is
corrupted in some way?
 
G

GitarJake

Hehe, welcome to my world!

Not only do I not see anything wrong here, there's no help or history to
this error that I can find!

Here are the references:

Visual Basic for Applications
MS Access 9.0 Object Library
OLE Automation
MS Calendar Control 9.0
MS ActiveX Data Objects 2.1 Library


Thanks for trying,

Jake
 
G

GitarJake

Thanks Ken,

I never could find any irregularities but moving it has solved more than one
quirk.

Jake
 

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