<Method 'Item'of object 'forms' failed'

XaloRichie

Registered User.
Local time
Today, 05:33
Joined
Jul 2, 2003
Messages
70
I have a button on a form and ON CLick It Opend a second form which is based on query. The Button is actually on a subform in the 1st Form and it needs to pass a value to the second form when it opens for the query criterion.

It was working yesterday but I went on too late and changed something which now results in a dialogue box popping up because the value has not passt to the second form.
Looking at the code in debug It says <Method 'Item'of object 'forms' failed> under the cursor.
Any Suggestions. Please
 
Post the VBA line of code where the error is occurring.
 
??

I'm not sure what line of code you mean ?
Access seems not to be able to find my form but it is there im not sure why it cant find it??
 
Here is the code

If Me![OrdStatID] = 1 Then

TDP = MsgBox("Are You Taking The Deposit Now?", vbYesNo)
If TDP = 7 Then
Me![OrdStatID] = 2

DoCmd.Save
Else
getdp:
getdp = InputBox("How Much Deposit Are You Taking?", vbOK)
On Error GoTo getdp
If getdp > 0 Then
Me![OrdStatID] = 3
Me![StDate] = Date
Me![DepTak] = Me![DepTak] + getdp
ElseIf getdp Is Null Or getdp = 0 Then
Me![OrdStatID] = 2
DoCmd.Save
End If

End If

ElseIf Me![OrdStatID] = 6 Then

DoCmd.OpenForm "O/SInvs"
Forms![O/SInvs]![IpassID] = Me![OrderID]
'docmd requery

ElseIf Me![OrdStatID] > 1 And Me![OrdStatID] < 6 Then

DoCmd.OpenForm "rettool1"
Forms![rettool1]![TPassID] = Me![TID]

End If
DoCmd.Requery
exRETToolbu:
Exit Sub


End Sub
It is rettool1 form that can't be found
 
it does exist

It is there in the DB window spelt the same
I can open it directly but Obviously I get prompted for the [TID] Value when going direct.

I have had this a couple of times and each time it seems due to a different reason.

I have a value in [TID] just cant pass it to the form??
 
Like This ?

DoCmd.OpenForm "rettool1"
Forms![rettool1]![TPassID] = Forms![Select Cus fm]![OrdersSub]![TID]

I cant beleive it It was working. If I go to a backup The same code works?????
I must have changed something, just seems like I go 2 steps forward and one back !
 
That's not the same code
If your button is on the main form and TID is on the subform you can't use Me![TID]
 
Both on Subform

Both [TID] & the button are on the subform.

What did you mean before about Using the name of the [TID] control ? the form/subform names as i showed last or have i got the wrong end of the twig?
 
Does it work with the full forms reference,what is TID, is it newly created?
 
No And No :)

No still cant find it with full names and {tid} is the name of a field in the subform (based on query of the Orders table) "does that make a difference", [TID] is the ToolID in that Order record.
So am looking at a form with cust details and subform of orders. if click button in subform should open another form Which shows details (eg shows the tool name not just id no's). At this point If the order status is invoiced but unpaid I shall prompt for "money paid" then ask if they want to print the Invoice.
 

Users who are viewing this thread

Back
Top Bottom