Compile error: Method or data member not found

I'd forgotten about this bug in Access 2003 VBA.  I was getting the message Compile error: Method or data member not found but the me. control was just fine.  In fact I could see the control in the line above.  I spent about 10 minutes trying things getting more and more frustrated. 

A dim memory of getting something weird like this before surfaced and so I tried putting a quote in the code to separate out the parts of the line of code that weren't, apparently, causing a problem.  And that fixed the problem.

Oh yeah, now I remember that bug.   If you have several me controls on a line, or maybe two field from a recordset or such VBA can get confused if one control or field doesn't exist and indicate an error with the other control or field before it on the same line.

In the below the red circled control ptxCostz is the problem while the white on black control ptxMarkupPct  is innocent of any wrong doing.    And see how ptxMarkupPct is used three lines up and at the beginning of the line?

VBAMethodOrDataMemberbug

Published Monday, June 16, 2008 1:49 AM by Tony
Filed under: ,

Comments

# Compile error: Sub or Function not defined

As a follow up to my previous blog entry Compile error: Method or data member not found here's the

Friday, June 27, 2008 2:06 PM by Tonys Microsoft Access Blog

# Compile error: Sub or Function not defined

As a follow up to my previous blog entry Compile error: Method or data member not found here's the

Friday, June 27, 2008 2:16 PM by Tonys Microsoft Access Blog

Leave a Comment

(required) 
(required) 
(optional)
(required)