473,394 Members | 1,960 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,394 software developers and data experts.

Proper Code Help

the program listed below runs and does what I want it to when I DO NOT INCLUDE the 2 "close" statements, but it gives me a "Member Not Found" error when I include the lines "fld.close" and "tbl.close". Can anyone tell me if I need these lines as a method of proper coding or have I used them improperly. I really want to understand how to code properly. Thank you 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

Debug.Print tblClientTable & "tblclienttable"
mAnswer = MsgBox("Add a field called LS Data?", vbYesNo)
If mAnswer = 6 Then

Set db = CurrentDb()

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
'fld.Close
'tbl.Close
Set fld = Nothing
Set tbl = Nothing
Set db = Nothing

End If

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



End Sub
Oct 27 '06 #1
2 1186
NeoPa
32,556 Expert Mod 16PB
As I understand it, you don't need to close Fields or TableDefs.
A RecordSet built on a TableDef would be different, although, even in that case the close would happen automatically when you set the last object reference to Nothing.
Oct 27 '06 #2
Thank you...I just didn't want to lead to corruption in my database because I didn't follow the proper channels!
Oct 27 '06 #3

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

Similar topics

2
by: JTrigger | last post by:
I am rather new to the XML and XSD world and was wondering what the code would look like to write the following XSD items as classes in C# with all the proper XML attributes to make them...
2
by: Kevin | last post by:
I am currently importing data into Access 2002 from 3 Sybase ASA 7.0 databases over a network. At this time I am using a ODBC System DSN connection using the proper ASA 7 driver. I would like to...
1
by: RC | last post by:
I have an Access 2002 database with many tables and forms (but just to keep things simple, let's say the DB has one Table "Table1" and one Form "Form1"). I have managed to cobble together so much...
9
by: Microsoft News Server | last post by:
Hi, I am currently having a problem with random, intermittent lock ups in my ASP.net application on our production server (99% CPU usage by 3 threads, indefinately). I currently use IIS Debug...
0
by: indian143 | last post by:
Hi all, Can I get any .net developpped library with proper UI, which gives the same functionality as DSO Framer control thats to display and edit office doc, xls etc files. Because the DSO Framer...
2
by: Swinky | last post by:
Can someone explain to me the proper syntax for requery and where to input it in my form? I have a main form "Account-Master" with two subforms: 1.) Contacts and 2.)TNotes. The TNotes subform...
0
by: yogarajan | last post by:
hi all i need proper alignment my treeview looks like <checkbox>Fruits(parent)-134 <checkbox>Mango(child)-45 <checkbox>Orange(child)-45 ...
1
nurikoAnna
by: nurikoAnna | last post by:
how to properly separate sql codes........ I am using &_ as a separator...because it will not suits the visual basic code form...it will skip to the next line that's why I am having trouble in it...
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...
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.