?
Solved

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

Posted on 2004-04-30
5
Medium Priority
?
2,260 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 640 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

649 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