Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

MS Access 2010- Run-Time Error 2501, OpenForm action cancelled (Urgent

#help #urgent access vba

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 1 posts

I'm very new to VBA coding 
I made a search form in which the information in the listbox should open up a form on double click

however, when i do it asks me to enter a parameter value and when i cancel it gives me a 2501 error

here's the code:

Private Sub List1_DblClick(Cancel As Integer)

Dim RowNumber As Integer
RowNumber = Me.List1.ListIndex + 1

Dim varCode, varTitle, varArtist, varLocation, varPrice, varType
varCode = (List1.Column(0, RowNumber))
varTitle = (List1.Column(1, RowNumber))
varArtist = (List1.Column(2, RowNumber))
varLocation = (List1.Column(3, RowNumber))
varPrice = (List1.Column(4, RowNumber))
varType = (List1.Column(5, RowNumber))

Dim Response As Integer
Response = MsgBox("Product Details" & vbCrLf & _
"------" & vbCrLf & _
"CD Code: " & varCode & vbCrLf & _
"Title: " & varTitle & vbCrLf & _
"Artist: " & varArtist & vbCrLf & _
"Location in Store: " & varLocation & vbCrLf & _
"Sale Price: " & varPrice & vbCrLf & _
"Type of Product: " & varType & vbCrLf & _
"For more information, click OK", vbOKCancel, "SearchResults")

If Response = vbOK Then
DoCmd.OpenForm "SearchResults", , , "[CDCode] = " & List1.Column(0)
Forms![SearchResults].CDCode.BorderColor = vbRed
Forms![SearchResults].CDCode.Enabled = False
Forms![SearchResults].CDCode.Locked = True


End If


please help its urgent :(

  • 0




    New Member

  • Member
  • Pip
  • 8 posts


there have been cases where printer was causing the error. Please try changing your default printer to something else, and try it. If that resolves the problem, remove your printer, and then add it again.

  • 0

Similar Topics

Also tagged with one or more of these keywords: #help, #urgent, access, vba

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP