Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

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

#help #urgent access vba

  • Please log in to reply

#1
usuliman

usuliman

    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

Else

End If

 

please help its urgent :(


  • 0

Advertisements


#2
softwaremaniac

softwaremaniac

    New Member

  • Member
  • Pip
  • 8 posts

Hello,

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