473,748 Members | 4,935 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help! Compile Error: Method or data member not found

Hi all,

Hopefully somebody can help. In Access 2002-SP2, I receive an error
from the VB Editor if I try to compile the following code (see below).
The error is as follows:

Compile Error: Method or data member not found

The follow subroutine is highlighted (specifically .txtNR_Program1 ):

'Assign values to 'Not Reported' column on the report.

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
Me.txtNR_Progra m1.Value = Tests_Status(1, "2005_2424" , "", "", "")
Me.txtNR_Progra m2.Value = Tests_Status(1, "p2427", "", "", "")
Me.txtNR_Progra m3.Value = Tests_Status(1, "p2428a", "p2428b", "", "")
End Sub

The code for the function, Tests_Status(), is listed below. The
function is in a separate module.

Public Function Tests_Status(in tStatus As Integer, _
strProgram1 As String, _
strProgram2 As String, _
strProgram3 As String, _
strProgram4 As String) As Integer
'For Access, define some object variables and make connections.
Dim cnn As ADODB.Connectio n
Set cnn = CurrentProject. Connection
Dim rst As New ADODB.Recordset
rst.ActiveConne ction = cnn
'Declare function variable
Dim intCountTests As Integer
Dim strStatus_F As String
Dim strProgram1_F As String
Dim strProgram2_F As String
Dim strProgram3_F As String
Dim strProgram4_F As String
'Get function inputs and format.
strStatus_F = "=" & intStatus & ""
strProgram1_F = "='" & strProgram1 & "')"
strProgram2_F = "='" & strProgram2 & "')"
strProgram3_F = "='" & strProgram3 & "')"
strProgram4_F = "='" & strProgram4 & "');"
'Build a SQL string
rst.Open "SELECT Count(tblTests.[LSTS_Reported]) AS [Count_Tests] "
& _
"FROM tblSamples INNER JOIN tblTests " & _
"ON tblSamples.LSTS _Number = tblTests.LSTS_N umber " & _
"WHERE (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram1_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram2_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram3_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram4_F
'Obtain records from the recordset called "rst"
intCountTests = rst("Count_Test s")
'Clear the object variables
rst.Close
cnn.Close
'Return value
Tests_Status = intCountTests
End Function

Why am I getting this error? Note that the report works fine in
operation. I only get this error when I try to compile the code. Thanks
in advanced.

Peter

Nov 13 '05 #1
2 23945
It's possible you have some form corruption. First, try changing
Me.txtNR_Progra m1 to Me!txtNR_Progra m1, and see if that helps. If it does
help, you probably do have form corruption, and it's probably not completely
fixed. In that case, you should rename the form, paste the controls and code
into a new form object, then delete the old form.

By the way, a policy of using ! instead of . for referencing controls on forms
seems to help reduce the frequency of form corruption problems.

On 26 Apr 2005 09:15:31 -0700, br******@inspec tion.gc.ca wrote:
Hi all,

Hopefully somebody can help. In Access 2002-SP2, I receive an error
from the VB Editor if I try to compile the following code (see below).
The error is as follows:

Compile Error: Method or data member not found

The follow subroutine is highlighted (specifically .txtNR_Program1 ):

'Assign values to 'Not Reported' column on the report.

Private Sub Detail_Format(C ancel As Integer, FormatCount As Integer)
Me.txtNR_Progra m1.Value = Tests_Status(1, "2005_2424" , "", "", "")
Me.txtNR_Progra m2.Value = Tests_Status(1, "p2427", "", "", "")
Me.txtNR_Progra m3.Value = Tests_Status(1, "p2428a", "p2428b", "", "")
End Sub

The code for the function, Tests_Status(), is listed below. The
function is in a separate module.

Public Function Tests_Status(in tStatus As Integer, _
strProgram1 As String, _
strProgram2 As String, _
strProgram3 As String, _
strProgram4 As String) As Integer
'For Access, define some object variables and make connections.
Dim cnn As ADODB.Connectio n
Set cnn = CurrentProject. Connection
Dim rst As New ADODB.Recordset
rst.ActiveConne ction = cnn
'Declare function variable
Dim intCountTests As Integer
Dim strStatus_F As String
Dim strProgram1_F As String
Dim strProgram2_F As String
Dim strProgram3_F As String
Dim strProgram4_F As String
'Get function inputs and format.
strStatus_F = "=" & intStatus & ""
strProgram1_F = "='" & strProgram1 & "')"
strProgram2_F = "='" & strProgram2 & "')"
strProgram3_F = "='" & strProgram3 & "')"
strProgram4_F = "='" & strProgram4 & "');"
'Build a SQL string
rst.Open "SELECT Count(tblTests.[LSTS_Reported]) AS [Count_Tests] "
& _
"FROM tblSamples INNER JOIN tblTests " & _
"ON tblSamples.LSTS _Number = tblTests.LSTS_N umber " & _
"WHERE (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram1_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram2_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram3_F & _
"OR (tblTests.LSTS_ Reported " & strStatus_F & _
"AND tblSamples.Prog ram_Number " & strProgram4_F
'Obtain records from the recordset called "rst"
intCountTests = rst("Count_Test s")
'Clear the object variables
rst.Close
cnn.Close
'Return value
Tests_Status = intCountTests
End Function

Why am I getting this error? Note that the report works fine in
operation. I only get this error when I try to compile the code. Thanks
in advanced.

Peter


Nov 13 '05 #2
Hi Steve,

That worked!

Strange! I never would have figured that out. Thanks again.

Peter
Steve Jorgensen wrote:
It's possible you have some form corruption. First, try changing
Me.txtNR_Progra m1 to Me!txtNR_Progra m1, and see if that helps. If it does help, you probably do have form corruption, and it's probably not completely fixed. In that case, you should rename the form, paste the controls and code into a new form object, then delete the old form.

By the way, a policy of using ! instead of . for referencing controls on forms seems to help reduce the frequency of form corruption problems.


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1441
by: Andy Eshtry | last post by:
Dear Friends I have a urgent problem to solve. I have created a class and its collection and then bind it to a datagrid but got the following error. Please help. Thanks in advance. Andy Eshtry No default member found for type 'clsAgentPostalCode' Line 44: Dim oAgentPostalCodeCollection As New clsAgentPostalCodeCollection(lAgentID)
0
1642
by: Kenny G | last post by:
Hello, Got a small problem: I built a small table and used the following on my laptop this morning. This code compiled and worked fine on my laptop but when I compiled the first Sub on my desktop I get compile error: Method or Data Member Not Found The words ProjectCode was highlighted.
0
1364
by: mazda_88 | last post by:
I have a number of tables inside a dataset. I have a repeater that I need to bind to. The data that is needed resides in two tables in the dataset. Here is the code that I'm using: Dim rel_Bridesmaid As DataRelation rel_Bridesmaid = New DataRelation("BridemaidOrder", _ _ds_Bridesmaid.Tables(Bridesmaid_DATA.PERSON_TABLE).Columns(Bridesmaid_DATA.PERSON_ID_FIELD), _...
1
4033
by: Tim::.. | last post by:
Can some one please tell me why I'm getting this error! I presume it is because there is something wrong with my Database connection but am not really sure what! Thanks ...:: Error ::.. System.MissingMemberException: No default member found for type 'Boolean'. ...:: CODE ::.. Private Sub cmdSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
1
1796
by: DS | last post by:
Hi all, Will appreciate if someone can help me with this problem. I am using VS 2003 on Win2000, sp 4. 2GB RAM. Session data is stored on DB on another machine in network. Can connect to the DB (no problem with that). I try to save DB connection string in web.config file, as described in MSDN 'Declaring and Accessing Section Groups' article. I think this is optimal way/place to store global variables accessible from any part of...
5
2483
by: solrium | last post by:
Good morning, Thanks in advanced.... and Here are the basics: VB 6.3 on W2K, Using for WRQ Reflections for IBM (v 13.0) Visual Basic Editor (built into the above mainframe) - As most stories go, a guy created a GUI as a macro using VB and saved everything under the shared folder for our clients' server, which then was deleted. Since he saved it as a macro it saved the .rsf file - but did not save any of the modules, or forms, that...
3
6723
by: DThreadgill | last post by:
Upon trying to compile my db, I get the following error - "Compile Error - Method or Data Member Not Found" and it highlights the .backcolor of the following code Private Sub Mentioned_Employee_GotFocus() Mentioned_Employee.BackColor = 65535 End Sub I viewed my references and there are none that says MISSING. These are the ones I do have: Visual Basic for Applications Microsoft Access 11.0 Object Library
1
2676
by: jayjayplane | last post by:
I have two combo boxes on my form, let's say box1(s1_individual_session) and box2(s1_nationality1), initially I disable box2(gray-out). I want to select box1 value is "true" then enable the box2, the code: Private Sub s1_individual_session_AfterUpdate() If Me.s1_individual_session.Value = True Then Me.s1_nationality1.Enabled = True Else Me.s1_nationality1.Enabled = False
15
11584
by: Elizabeth Mitte | last post by:
Hello, Before I ask my question, I want to say how good this forum is and how much help it has been to a complete novice. At this moment in time I am having trouble creating VBA syntax (I think that is what it is called) that works to update one combo box (in subform) from another (in the main form). I have tried the same 'code' in the sample Northwind database and it works just fine. I have tried replacing '.' with '!' to no avail and...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.