Solved

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

Posted on 2004-04-30
5
2,120 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
  • 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now