Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"You cancelled the previous operation" when accessing a subform

Status
Not open for further replies.

Boham

Technical User
Jun 8, 2006
23
US
I have a simplistic simplistic Form/Subform (Order/Order Details) partnership. The idea is for the users to select a Pub_No from the dropdown list and "DLookup" will provide the Description for that Pub_No. All is working well in the subform however; when I use the Orders Form, I get "You cancelled the previous operation" when I select the Pub_No from the drop down. Any Help would be appreciated...

VB Code for DLookup:

Private Sub ProductID_AfterUpdate()
On Error GoTo ProductID_AfterUpdate_Err

Dim StField As String
StField = "Pub_No"
StField = "forms![Order Details Subform]!Pub_No"
Description = DLookup("Description", "Pub_Index", "[Pub_No] =" & StField)

ProductID_AfterUpdate_Exit:
Exit Sub

ProductID_AfterUpdate_Err:
MsgBox Error$
Resume ProductID_AfterUpdate_Exit

End Sub
 
Why not simply this ?
Description = DLookup("Description", "Pub_Index", "Pub_No=" & Me!ProductID)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV

Thanks for the quicke response however; after Remarking out my code and replacing with your suggested code, I now get the error in the Subform as well
 
ok, I got this one fixed... It helps if you plug in the correct field when using the DLookup Function...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top