473,703 Members | 2,438 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 23942
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
1439
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
1639
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
1362
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
4023
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
1793
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
2479
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
6715
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
2672
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
11576
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
8662
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9244
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
9004
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,...
0
8961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6585
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
4679
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2439
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2058
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.