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

Open Form Action was Cancelled Error!!!

Status
Not open for further replies.

bobbobruns12

Technical User
Jun 30, 2004
27
0
0
US
I have a form that I am using Docmd to open which applies a filter for me to open only certain records. I have never had a problem until recently but suddenly now I click on the cmd button for the form and it gives me the error message "OpenForm Action was cancelled." On my backup database my code works perfectly, just with the new one (the one with all the updated info on it) I am continuing to have this error. I have tried to import the form from the other database thinking that there is a code glitch however it still leaves me with the same problem. My code looks like

Private Sub AddPlayerscmd_Click()
On Error GoTo Err_AddPlayerscmd_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "AddPlayersEntryfrm"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'saves record
strAddFilter = " APTransID = " & Chr(34) & Me.TransDataEntryTransIDtxt.Value & Chr(34)
DoCmd.OpenForm stDocName, , , strAddFilter, , , "Me.TransDataEntryTransIDtxt"


Exit_AddPlayerscmd_Click:
Exit Sub

Err_AddPlayerscmd_Click:
MsgBox Err.Description
Resume Exit_AddPlayerscmd_Click
End Sub

And on the form I have:

Private Sub Form_Current()
Me.AddPlayersTransIDEntrytxt = Me.OpenArgs
[AddPlayersIDEntrytxt] = Forms![TransDataEntryfrm]![TransDataEntryIDtxt]
End Sub

I feel like I've tried anything and I'm really against a wall. If anyone could help I'd really appreciate it. Thank you


 
I would suggest that you have bad data in "strAddFilter" that is causing the form open command to error.

Just a Guess, try msgbox on the built up string to see if syntax is correct when viewed.
 
ok I think I have it targeted at the fact that the ID that is being used in the filter is a number data type. I found this when I went back into my backup and saw that it was working when it was a text datatype but when I changed it to number it did the same thing. I wanted to keep it a number though because its connected to an autonumber field. Any thoughts?
 
Replace this:
strAddFilter = " APTransID = " & Chr(34) & Me.TransDataEntryTransIDtxt.Value & Chr(34)
By this:
strAddFilter = " APTransID = " & Me!TransDataEntryTransIDtxt.Value

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
No code in the Load or Open event procedures of AddPlayersEntryfrm ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ok I got it to work somehow. I deleted and remade the table column for the id, as well as using the replaced filter from above and it has seemed to fix itself.

Thanks for the help PHV and 1DMF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top