UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Run-time error '40036': Method 'Item' of object 'Forms' failed    
 
   
cypage
post Jul 12 2007, 12:15 AM
Post#1



Posts: 52
Joined: 22-August 06



I am about pulling my hair out over this one...I made a form that is supposed to open another form when a button is clicked. It is then supposed to fill in some unbound fields on the other form. It wrote this code and then didn't touch it. After a while...it stopped working and started giving me this error!!! I can't figure it out! This code should work...because it USED TO!!!
HHHHHHH...thanks for any help in advance
CODE
Dim CaseInformation
Set CaseInformation = CurrentDb.OpenRecordset("SELECT Clients.CaseNumber, Clients.FirstName, Clients.MI AS MiddleName, Clients.LastName FROM Clients INNER JOIN ClientsSubPrintDocumentationCaseNumber ON Clients.CaseNumber = ClientsSubPrintDocumentationCaseNumber.CaseNumber;")
If CaseInformation.BOF Or CaseInformation.EOF = True Then
    MsgBox "No records were found.", vbCritical, "No Data"
    Set CaseInformation = Nothing
    Exit Sub
Else
    CaseInformation.MoveFirst
    DoCmd.OpenForm "ClientsPrintCaseLabel"
    Forms!ClientsPrintCaseLabel.CaseNumber = CaseInformation.CaseNumber
    Forms!ClientsPrintCaseLabel.FirstName = CaseInformation.FirstName
    Forms!ClientsPrintCaseLabel.MiddleName = CaseInformation.MiddleName
    Forms!ClientsPrintCaseLabel.LastName = CaseInformation.LastName
    Set CaseInformation = Nothing
    Exit Sub
End If

It errors on the line that reads "Forms!ClientsPrintCaseLabel.CaseNumber = CaseInformation.CaseNumber"
PLEASE...help me...
Go to the top of the page
 
bome
post Jul 12 2007, 12:22 AM
Post#2


UtterAccess VIP
Posts: 1,644
Joined: 24-May 02
From: Sweden


When you are referencing a column by name in the recordset you must use the syntax
orms!ClientsPrintCaseLabel.CaseNumber = CaseInformation("CaseNumber")
___________
Bo Melin
Go to the top of the page
 
cypage
post Jul 12 2007, 02:21 PM
Post#3



Posts: 52
Joined: 22-August 06



Thanks for the reply bome...but that doesn't seem to fix the problem. I still get an error message saying: "error '40036': Method 'Item' of object 'Forms' failed"....It has a problem with the way that I am refering the form for some reason that I cannot figure out!! The weirdest thing about this problem (and the most unique) is that IT WAS JUST WORKING!!! haha...that's so frustrating.
Thank again to anyone who can help me out
Go to the top of the page
 
balaji
post Jul 12 2007, 02:47 PM
Post#4


UtterAccess VIP
Posts: 5,637
Joined: 23-January 03
From: Chicagoland, USA


Try:
im CaseInformation as dao.recordset
Go to the top of the page
 
cypage
post Jul 12 2007, 03:05 PM
Post#5



Posts: 52
Joined: 22-August 06



Thanks balaji...I was going to try that but then I decided to try and make a completely new form and delete the old one and...it works! I have no idea what the [censored] went wrong with Access...but I guess it shouldn't surprise me. Sorry for wasting all your guys' time...
Thanks
Go to the top of the page
 
balaji
post Jul 12 2007, 03:41 PM
Post#6


UtterAccess VIP
Posts: 5,637
Joined: 23-January 03
From: Chicagoland, USA


Glad you got it sorted out. Good luck with your project. thumbup.gif
Go to the top of the page
 
jmcwk
post Jul 12 2007, 05:07 PM
Post#7


UtterAccess VIP
Posts: 12,559
Joined: 21-November 02
From: Tacoma, WA.


Never a Waste of time ! Thats why we are here sad.gif
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th November 2017 - 11:03 PM