jonplaca
jonplaca

Reputation: 827

MS Access + VBA - OnClick() event error: "Method or Data Member not found"

OBJECTIVE

Create a dashboard for the Marketing team to pull in product information (e.g product, customer, inventory, sales forecasts, etc.) for further analysis.

APPROACH

  1. Access Product, Inventory, and Sales databases.
  2. Create Query to join Product, Inventory, and Sales details.
  3. Create a simple UI for the Marketing team to interact with queried results.

CODE

simple script for the Marketing team to review a table, prior to query execution

Public Sub reviewCatalog()
DoCmd.OpenTable "Table - Active Customer Catalog", acViewNormal
DoCmd.OpenTable "Table - Active Product Catalog", acViewNormal
End Sub

call reviewCatalog() script from a button OnClick() event that is presented in a simple UI/Form

Public Sub reviewCatalog_Click()
Call reviewCatalog.reviewCatalog
End Sub

ERROR

Compile Error: Methor or data member not found

NOTES

QUESTIONS

  1. What is the nature of the error being thrown? Why is it only occuring on the reviewCatalog_onClick() event (as opposed to other, similar buttons & scripts)?

Upvotes: 0

Views: 655

Answers (1)

jonplaca
jonplaca

Reputation: 827

Nevermind, I am a dummy.

Due to the similar naming convention of the button name and the macro, MS Access was throwing an error.

I've updated the button name to "reviewCatalogs" (from "reviewCatalog"). After updating the button name and the Public Sub to Public Sub reviewCatalogs_Click(), the script worked.

Upvotes: 1

Related Questions