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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenForm action cancelled

Status
Not open for further replies.

bill1one

Programmer
Sep 29, 2004
93
US
The results of a SQL statement are posted in a listbox titled, lstResolution. I want to open another form (frmEdit) when a user double-clicks an item from the list, based on the field tblResolution.Number. Here is my code for that:

DoCmd.OpenForm "frmEdit", acNormal, , "[tblResolution.Number] = " & Me.lstResolution, acFormReadOnly, acDialog

Every time I double-click an item I get a Run-time Error '2501', saying "The OpenForm action was cancelled."

Any Suggestions?
 
Number is probably a reserved word, the way you're passing it, it looks for a field called tblResulution.Number, I think, try just

[tt]DoCmd.OpenForm "frmEdit", , , "[Number] = " & Me.lstResolution[/tt]

first, assuming [Number] is numeric. Then if it works, add the rest of the arguements.

Roy-Vidar
 
Still didn't work. Should I chnage Number to ID or something?
 
Could it be becuase of an input mask I'm using.
The input mask is: !\(999\-00") "
This way number appear as (123-45)
When a number is passed on from the result list, it looks like it is stripping the paranthesis and hyphen.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top