473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Method Or Dta Member Not Found

Can anyone help me with an error message i am receiving? I am trying with the code below to add a field to an existing table. My code doesn't even perform the debug. It jumps to the "fld.close" line and displays a compile error "method or data member not found". I thought maybe my table name variable was incorrect, but it won't even perform the debug. thanks for any help!

Private Sub lstTableList_AfterUpdate()
Dim db As dao.Database
Dim tbl As dao.TableDef
Dim fld As dao.Field
Dim tblClientTable As String

tblClientTable = Forms!frmDailyClient!lstTableList & "_" & MyValue
Debug.Print tblClientTable
mAnswer = MsgBox("Add a field called LS Data?", vbYesNo)
If mAnswer = 6 Then

' Start by opening the database
Set db = CurrentDb()
' Create a tabledef object
Set tbl = db.TableDefs(tblClientTable)

' Create field; set its properties; add it to the tabledef
Set fld = tbl.CreateField("LSRate", dbDouble)
tbl.Fields.Append fld

End If

Me!lstFieldList.Visible = True
Me!lstFieldList.SetFocus
Me!lstTableList.Visible = False

fld.Close
Set fld = Nothing
tbl.Close
Set tbl = Nothing
Set db = Nothing

End Sub
Oct 26 '06 #1
3 1871
pks00
280 Expert 100+
Which line does it fall over on

Did u know u are closing fld when u havent even set it

U set fld inside a IF statement, but close it outside. That can cause a problem
Same applies to tbl
Oct 26 '06 #2
NeoPa
32,556 Expert Mod 16PB
When you start to run any code, the parser will run a preliminary check through your code without compiling it.
It's checking for the obvious errors.
If it finds one it won't even start to execute the code but it will select the first line at fault and display a relevant error message.
pks00 has already drwawn your attention to certain things you need to change in your code which might explain why the parser wouldn't continue.
Oct 26 '06 #3
PEB
1,418 Expert 1GB
Hi

It seems that fld doesn't suport the close property

And I think that you need to close your table and your database and not your field and your table!

So the first step remove this line

The second one db.close to close the opened instance of the database!

:)
Oct 27 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: Tim Martin | last post by:
Hi, I came across a detail in "C++ Gotchas" by Stephen Dewhurst that confused me a bit. The author states: 'C++ has no "methods." Java and Smalltalk have methods. When you talk about an...
0
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...
5
by: kuvpatel | last post by:
Hi I want to refer a class called LogEvent, and use one of its methods called WriteMessage without actually having to create an instance of Logevent. I have tried using the word sealed with...
12
by: Rubbrecht Philippe | last post by:
Hi there, According to documentation I read the ArrayList.IndexOf method uses the Object.Equals method to loop through the items in its list and locate the first index of an item that returns...
6
by: Teresa | last post by:
1) If I do want to keep an object alive throughout the live of an application, how can I ensure that the GC doesn't clean it up? 2a) How do I determine if an object is a managed or an unmanged...
2
by: Kevin Frey | last post by:
Consider this simple example: interface IReader { bool Read( ); }; class MyReader : IReader { bool Read( ); // or should it be bool IReader.Read( ) ?
8
by: David Veeneman | last post by:
Should a member variable be passed to a private method in the same class as a method argument, or should the method simply call the member variable? For years, I have passed member variables to...
8
by: Chris Noble | last post by:
I need to check whether a particular user is already a member of an Active Directory Security Group. The following code extract works but only if the user distinguished name is exactly the same...
1
by: almeister9 | last post by:
I am hoping someone can help me as I've done this sort of thing before with no problems. I am using Access 2003 SP2 on WinXP prof SP2 I have an unbound form (single form view) with 18 unbound text...
0
by: =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?= | last post by:
"Anders Borum" wrote: Hi Anders, I'm afraid the GetMethod() does not currently support filtering on generic parameters so you will have to loop through the existing methods using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.