Solved

Access 2000 Run-time error 40036:  Method 'Item' of object 'Forms' failed - Please help

Posted on 2004-04-30
5
2,189 Views
Last Modified: 2007-12-19
I keep getting a Run-time error 40036:  Method 'Item' of object 'Forms' failed error in Access 2000.
This problem is strange.  Some variation of very simple code below worked earlier today and now it doesn't.  I don't know what I changed or did but it I can't figure out how to fix it.  I have tried so many different ways that I don't remember which set of code was the original one that worked.  The frmChangeLeaseGetLeaseNumber form opens but when the second line of code runs I get the error.  The txtOpenedFrom control exists.  Here is some variations that will not work for me:

Private Sub cmdChangeMasterLease_Click()

    DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"
    Forms!frmChangeLeaseGetLeaseNumber.Controls("txtOpenedFrom").Value = "Change Master"
   
End Sub

I have also tried:

Private Sub cmdChangeMasterLease_Click()

    DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"
    Forms!frmChangeLeaseGetLeaseNumber!txtOpenedFrom = "Change Master"
   
End Sub

and

Private Sub cmdChangeMasterLease_Click()

    DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"
    Forms!frmChangeLeaseGetLeaseNumber!txtOpenedFrom.Value = "Change Master"
   
End Sub


and:

Private Sub cmdChangeMasterLease_Click()

    DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"
    Forms("frmChangeLeaseGetLeaseNumber").Controls("txtOpenedFrom") = "Change Master"
   
End Sub

Private Sub cmdChangeMasterLease_Click()

    DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"
    Forms("frmChangeLeaseGetLeaseNumber").Controls("txtOpenedFrom") .Value= "Change Master"
   
End Sub

I have also tried declaring a form variable and using that in the code but that hasn't helped either.
Please help me!

Thankyou,

Chad
0
Comment
Question by:travelcenters
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:phileoca
ID: 10962744
Forms!Yourform.Controls!YourField.Value = "value"

Notice, after YourForm is .Controls

Forms!frmChangeLeaseGetLeaseNumber.Controls!txtOpenedFrom.Value = "Change Master"

0
 

Author Comment

by:travelcenters
ID: 10962798
phileoca,

That doesn't work either.  I don't think it is a syntax issue.  I think something else is happening.  I searched the internet for similar problems and the ones I found all said that the problem was sporadic and that one day the code would work and the next day it wouldn't.  There is some bug in my opinion.  Has anyone seen this before?

Thanks again,

Chad
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 160 total points
ID: 10962857
hmmm...try setting your value before opening the form...

Public myValue


myvalue =  "Change Master"
DoCmd.OpenForm "frmChangeLeaseGetLeaseNumber"


then in the form_open event of "frmChangeLeaseGetLeaseNumber"

me!txtOpenedFrom = myValue
0
 

Author Comment

by:travelcenters
ID: 10963076
SidFishes,
Thank you so much!!  You have no idea how long this has been driving me crazy.

Sincerely,
Chad
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 10963149
oh yes i do...been there..:)...glad to help
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question