Run-time error 40036 (1 Viewer)

hirex

New member
Local time
Today, 01:06
Joined
Jan 8, 2015
Messages
7
Hello,

I'm working on Access 2010 with data on SQL Server 2008 R2.

I want to open a form linked to a stored procedure.
To do that, I have followed these steps :

1) Create the stored procedure on SQL Server that we could call "pr_example"

2) Create a query on Access named "pr_example" with this SQL code inside :
EXEC pr_example

3) In the form, called "frmExample", I have set "pr_example" as record source

4) In my code that open the form, I have done the following :
dim qryFrm As QueryDef
Set qryFrm = pdbmydb.QueryDefs("pr_example")
qryFrm .SQL = "EXEC pr_example" & frmmyForm!LotID
docmd.OpenForm "frmExample"
msgbox Forms!frmExample!TbxID

This code open "frmExample" when clicking on a button in the form "frmmyform".
I'm getting error "Run-time Error 40036 - Application-defined or object-defined error" when trying to execute "msgbox Forms!frmExample!TbxID".
I'm also getting the tooltip "method item of object forms failed" on the "Forms!frmExample!TbxID" line.

I don't understand why :banghead:
Many many thanks in advance for your help.
Chris
 

hirex

New member
Local time
Today, 01:06
Joined
Jan 8, 2015
Messages
7
I have found the problem.

Just a compilation error.....:D
A syntax error in the name of a textbox in an event code of the form....

Hope this help.:p
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:06
Joined
Aug 30, 2003
Messages
36,125
Thanks for posting your solution and welcome to the site!
 

Users who are viewing this thread

Top Bottom