Kamis, 01 Desember 2011

[MS_AccessPros] Error 2046 The command or action "Find" is not available now

 

Good morning!

I am getting above error upon clicking a button which opens the Listing form and then opens the Find dialogue. I have done this a zillion times and am now getting the error. I don't think that I've made any changes that would make it happen now. Depending on which button is clicked the form is loaded with All listings, Current Listings, Sold Listings, etc. The Sold Listings button is not having issues. All, Current and Off are having this problem. I have included the code behind the open Current Listings button and the open Sold Listings button. The only difference I can see is where the Listing form is opened. One is acEdit and the other not.

Upon opening the Listings form the Find dialogue is also opened because the user is often going to need to find a Listing as the Listing form is the goto form for all aspects of Listings because it holds the basic info in addition to the buttons for changes (Sold, Withdrawn, etc). Previously they were typing into the blank form to try to find a listing.

Thanks!
Connie

Button which does not work and gets error:
Private Sub btnCurrentListings_Click()
'set up Error Handler
On Error GoTo Proc_Err
'~~~~~~~~~~~~~~~~~~~~~~
Dim strSql2 As String

'create query for all recordsource with all current listings
strListingsRecordsource = "SELECT Listings.* FROM Listings " & _
"WHERE Listings.CurrentListing = -1;"

'Open Listings form
DoCmd.OpenForm "Listings", acNormal

'Set Form title/caption to "current Listings"
Forms!Listings.FormTitle.Caption = "Current Listings"
'Set Listings RecordSource
Forms!Listings.RecordSource = strListingsRecordsource

'Set rowsource for cboSearch box
strSql2 = "SELECT DISTINCT qListingContacts.ContactID, qListingContacts.ConcatName, qListingContacts.SpouseFN " & _
"FROM qListingContacts INNER JOIN Listings ON qListingContacts.ListID = Listings.ListID " & _
"WHERE CurrentListing = -1 " & _
"ORDER BY qListingContacts.ConcatName;"

'Set RowSource for cboSearch box
Forms!Listings.cboSearch.RowSource = strSql2

'Close form
DoCmd.Close acForm, "ListingsSoldWdSelectForm"
'Open Find Dialog box
DoCmd.RunCommand acCmdFind

Button which works and opens the Find box once opened
Private Sub btnSoldListings_Click()
On Error GoTo Proc_Err

Dim strSql2 As String
'create query for all sold listings
strListingsRecordsource = "SELECT DISTINCTROW Listings.* FROM Listings " & _
"INNER JOIN Sales ON " & _
"Listings.ListID = Sales.ListID;"

'Open Listings form
DoCmd.OpenForm "Listings", , , , acFormEdit

'Set Form title/caption to "Sold Listings"
Forms!Listings.FormTitle.Caption = "Sold Listings"
'Set Listings RecordSource
Forms!Listings.RecordSource = strListingsRecordsource

'Set rowsource for cboSearch box
strSql2 = "SELECT DISTINCT qListingContacts.ContactID, qListingContacts.ConcatName, qListingContacts.SpouseFN " & _
"FROM qListingContacts INNER JOIN Sales ON qListingContacts.ListID = Sales.ListID " & _
"ORDER BY qListingContacts.ConcatName;"
'Set RowSource for cboSearch box
Forms!Listings.cboSearch.RowSource = strSql2

'Close form
DoCmd.Close acForm, "ListingsSoldWdSelectForm"
'Open Find Dialog box
DoCmd.RunCommand acCmdFind

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar